/* 矽谷生存手冊 優化版
   配色（補充 A3，臺大創創藍綠）：主色 #006F6A、輔色 #1A2E4A、點綴 #00B6BE（只用小面積，上面不放白字）
   紙色 #F5F2EA＋細顆粒；內文炭灰 #414042。危險提示框的紅色是狀態色，只用在 note-danger。 */

:root {
  --paper: #f5f2ea;
  --paper-hi: #fbf9f4;
  --paper-2: #ece7db;
  --mint: #e9f8f5;
  --mint-2: #d5ebe6;
  --mint-3: #bcdcd6;
  --teal: #006f6a;
  --teal-dk: #00524e;
  --navy: #1a2e4a;
  --aqua: #00b6be;
  --aqua-tint: #dcf2f3;
  --ink: #414042;
  --ink-2: #5f5d58;
  --line: #d9d2c3;
  --line-2: #e6e0d2;
  --danger: #9e3a2f;
  --danger-tint: #f8ece8;

  --font-sans: "Noto Sans TC", -apple-system, "PingFang TC", "Heiti TC", "Microsoft JhengHei", sans-serif;
  --font-serif: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --font-cond: "Barlow Condensed", "Noto Sans TC", sans-serif;

  --paper-edge: 0 0 0 1px rgba(26, 46, 74, 0.09);
  --paper-shadow: 0 0 0 1px rgba(26, 46, 74, 0.08), 0 1px 1px rgba(26, 46, 74, 0.06), 0 10px 24px -14px rgba(26, 46, 74, 0.32);
  --paper-shadow-lift: 0 0 0 1px rgba(26, 46, 74, 0.1), 0 2px 3px rgba(26, 46, 74, 0.08), 0 26px 40px -18px rgba(26, 46, 74, 0.42);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .1 0 0 0 0 .18 0 0 0 0 .29 0 0 0 .075 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --topbar-h: 60px;
  --gutter: clamp(16px, 4vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; scroll-padding-top: calc(var(--topbar-h) + 20px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  overflow-x: clip;
  background-color: var(--paper);
  background-image: var(--grain);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: var(--teal); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 3px; }
kbd { font-family: var(--font-cond); font-size: 12px; line-height: 1; padding: 3px 6px 2px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; color: var(--ink-2); background: var(--paper-hi); }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 6px; }
.skip:focus { top: 12px; }
[hidden] { display: none !important; }
.no { font-family: var(--font-cond); font-weight: 600; letter-spacing: 0.02em; }

/* ---------- 頁首 ---------- */
/* 回課程頁（只有子路徑版）：頁首上方一條細帶，跟著頁面捲走，不佔 sticky 頁首的高度 */
.parent-bar { background: var(--navy); padding: 0 var(--gutter); padding-left: max(var(--gutter), env(safe-area-inset-left)); }
.parent-link { display: inline-block; padding: 7px 0; font-size: 13px; line-height: 18px; letter-spacing: 0.02em; color: #fff; text-decoration: none; }
.parent-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 24px;
  padding: 0 var(--gutter);
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  background: rgba(245, 242, 234, 0.94);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-2);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--navy); text-decoration: none; flex: none; min-width: 0; }
.brand-mark { width: 28px; height: 22px; color: var(--teal); display: grid; }
.brand-name { font-family: var(--font-serif); font-weight: 700; font-size: 19px; letter-spacing: 0.04em; white-space: nowrap; }
.brand-ed { font-family: var(--font-cond); font-weight: 600; font-size: 14px; color: var(--teal); border: 1px solid var(--mint-3); background: var(--mint); border-radius: 999px; padding: 0 8px; line-height: 20px; }
.topnav { display: flex; gap: 20px; margin: 0 auto; }
.topnav a { color: var(--ink); text-decoration: none; font-size: 14.5px; white-space: nowrap; padding: 6px 0; position: relative; }
.topnav a .no { color: var(--teal); font-size: 13px; margin-right: 4px; }
.topnav a:hover { color: var(--navy); }
.topnav a[aria-current]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--aqua); border-radius: 2px; }
.topbar-tools { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.tool-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--paper-hi);
  color: var(--navy); font: inherit; font-size: 14px; text-decoration: none; cursor: pointer; list-style: none; white-space: nowrap; flex: none;
}
.tool-btn::-webkit-details-marker { display: none; }
.tool-btn svg { width: 18px; height: 18px; flex: none; }
.tool-btn:hover { border-color: var(--mint-3); background: var(--mint); }
.menu { position: relative; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 10px); width: min(360px, calc(100vw - 32px));
  background: var(--paper-hi); border-radius: 10px; box-shadow: var(--paper-shadow-lift); padding: 18px 20px 16px;
  max-height: calc(100svh - var(--topbar-h) - 24px); overflow: auto;
}
.menu-panel ul { list-style: none; margin: 0 0 12px; padding: 0; }
.menu-panel li a { display: block; padding: 7px 0; color: var(--navy); text-decoration: none; border-bottom: 1px solid var(--line-2); font-size: 15px; }
.menu-panel li a:hover { color: var(--teal); }
.menu-panel .no { color: var(--teal); margin-right: 8px; }
.menu-panel .is-current a { color: var(--teal); font-weight: 700; }
.menu-label { margin: 4px 0 2px; font-size: 12px; letter-spacing: 0.12em; color: var(--ink-2); }
.menu-index { display: flex; align-items: center; justify-content: space-between; color: var(--teal); font-weight: 700; text-decoration: none; padding-top: 4px; }
.menu-index svg { width: 18px; height: 18px; }
@media (max-width: 1180px) { .topnav { display: none; } }
@media (max-width: 560px) {
  :root { --topbar-h: 56px; }
  .topbar { gap: 10px; }
  .brand-name { font-size: 17px; }
  .tool-btn { padding: 0 10px; height: 36px; }
  .tool-btn kbd { display: none; }
}
@media (max-width: 400px) { .brand-ed { display: none; } }
@media (max-width: 374px) { .tool-btn span { display: none; } }

/* ---------- 紙卡共用 ---------- */
.card { position: relative; border-radius: 6px; box-shadow: var(--paper-shadow); }
.card > a { color: inherit; text-decoration: none; display: flex; flex-direction: column; height: 100%; border-radius: inherit; }

/* ---------- 首頁：桌面與資料夾 ---------- */
.page-home { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
.desk { position: relative; max-width: 1380px; margin: 0 auto; padding: 46px var(--gutter) 40px; }
.folder { position: absolute; inset: 46px var(--gutter) 40px; z-index: 0; pointer-events: none; }
.folder-back {
  position: absolute; inset: 0; border-radius: 4px 18px 16px 16px;
  background: var(--mint-2); box-shadow: inset 0 0 0 1px rgba(0, 111, 106, 0.16), 0 18px 40px -26px rgba(26, 46, 74, 0.45);
}
.folder-tab {
  position: absolute; left: 0; top: -34px; height: 36px; padding: 0 22px 0 20px;
  display: flex; align-items: center; gap: 12px;
  background: var(--mint-2); border-radius: 14px 18px 0 0; box-shadow: inset 1px 1px 0 rgba(0, 111, 106, 0.16), inset -1px 0 0 rgba(0, 111, 106, 0.16);
  font-family: var(--font-cond); font-weight: 600; font-size: 14px; letter-spacing: 0.16em; color: var(--teal-dk);
}
.folder-tab b { font-weight: 600; color: var(--navy); letter-spacing: 0.04em; }
.folder-sheet { position: absolute; left: 3%; right: 4%; top: 16px; height: 60%; background: var(--paper-hi); border-radius: 3px; box-shadow: var(--paper-edge); }
.folder-sheet.s1 { transform: rotate(-0.6deg); }
.folder-sheet.s2 { left: 6%; right: 2%; top: 26px; transform: rotate(0.5deg); background: #fdfcf8; }
.folder-front {
  /* 上緣用固定 px：字型換上來時資料夾高度會變，用百分比會讓上緣跟著移動（CLS） */
  position: absolute; left: 0; right: 0; bottom: 0; top: 250px;
  background: var(--mint); border-radius: 4px 4px 16px 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 -1px 0 rgba(0, 111, 106, 0.18), 0 -10px 24px -18px rgba(26, 46, 74, 0.35);
}
.folder-front::before { /* 前片口袋的缺口 */
  content: ""; position: absolute; left: 50%; top: -1px; width: 120px; height: 14px; transform: translateX(-50%);
  background: var(--mint-2); border-radius: 0 0 60px 60px / 0 0 14px 14px; box-shadow: inset 0 -1px 0 rgba(0, 111, 106, 0.16);
}

.desk-grid { position: relative; z-index: 2; display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 36px; padding: 48px 44px 44px; align-items: start; }

/* 封面卡：深海軍藍＋白字 */
.cover-card { background: var(--navy); color: #fff; padding: 40px 34px 34px; transform: rotate(-1deg); }
.cover-card .binder { position: absolute; top: -14px; left: 50%; width: 64px; height: 26px; transform: translateX(-50%); border-radius: 4px 4px 2px 2px; background: linear-gradient(#56606b, #2f3740); box-shadow: 0 2px 3px rgba(0, 0, 0, 0.25); }
.cover-card .binder::before, .cover-card .binder::after { content: ""; position: absolute; top: -16px; width: 16px; height: 22px; border: 2.5px solid #8a939c; border-bottom: 0; border-radius: 10px 10px 0 0; }
.cover-card .binder::before { left: 10px; }
.cover-card .binder::after { right: 10px; }
.cover-kicker { margin: 0 0 18px; font-size: 13.5px; line-height: 1.6; color: #cfe3e8; letter-spacing: 0.04em; }
.cover-card h1 { margin: 0; font-family: var(--font-serif); font-weight: 700; font-size: clamp(52px, 4.7vw, 68px); line-height: 1.12; letter-spacing: 0.04em; font-feature-settings: "palt"; }
.cover-card h1 span { display: block; white-space: nowrap; }
.cover-card h1 span:first-child { font-size: 0.62em; letter-spacing: 0.2em; color: #cfe3e8; }
.cover-en { margin: 12px 0 0; font-family: var(--font-cond); font-weight: 500; font-size: 17px; letter-spacing: 0.1em; text-transform: uppercase; color: #cfe3e8; }
.cover-en b { color: var(--aqua); font-weight: 600; letter-spacing: 0.04em; }
.cover-lead { margin: 22px 0 28px; font-size: 16px; line-height: 1.85; color: #eef3f6; text-align: justify; }
.cover-actions { display: flex; flex-wrap: wrap; gap: 10px; }
/* 出處（補充 A4）：封面卡底部一行小字，連回組員的原版 */
.cover-source { margin: 22px 0 0; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.16); font-size: 12.5px; line-height: 1.7; color: #cfe3e8; overflow-wrap: anywhere; }
.cover-source a { color: #fff; text-underline-offset: 3px; }
.source-link { display: inline-block; }
.cover-source a { white-space: nowrap; } /* ↗ 跟著網址，不單獨掉到下一行 */
.nowrap { white-space: nowrap; }
.cover-source a::after, .foot-source a::after { content: "↗"; font-size: 0.85em; margin-left: 2px; display: inline-block; text-decoration: none; }
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; font-size: 15px; font-weight: 500; text-decoration: none; max-width: 100%; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--teal); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.btn-primary:hover { background: var(--teal-dk); }
.btn-ghost { color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8); }

/* 章節卡 */
.chapter-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px 22px; }
.chapter-card {
  --rot: 0deg; --dy: 0px;
  min-height: 268px;
  transform: translateY(var(--dy)) rotate(var(--rot));
  transition: transform 0.32s var(--ease-out), box-shadow 0.32s var(--ease-out);
}
.chapter-card > a { padding: 18px 20px 16px; }
.chapter-card:nth-child(1) { --rot: -2deg; --dy: 6px; }
.chapter-card:nth-child(2) { --rot: 1.4deg; --dy: -4px; }
.chapter-card:nth-child(3) { --rot: -1deg; --dy: 10px; }
.chapter-card:nth-child(4) { --rot: 1.8deg; --dy: 2px; }
.chapter-card:nth-child(5) { --rot: -1.6deg; --dy: -6px; }
.chapter-card:nth-child(6) { --rot: 1deg; --dy: 6px; }
/* pin-19：單張上浮、轉正 */
.chapter-card:hover, .chapter-card:focus-within { transform: translateY(calc(var(--dy) - 12px)) rotate(0deg); box-shadow: var(--paper-shadow-lift); z-index: 3; }
.card-tab { position: absolute; top: -20px; right: 18px; height: 21px; padding: 0 10px; border-radius: 6px 6px 0 0; font-family: var(--font-cond); font-weight: 600; font-size: 12.5px; letter-spacing: 0.1em; line-height: 22px; background: var(--card-bg); color: inherit; box-shadow: 0 -1px 0 rgba(26, 46, 74, 0.08), 1px 0 0 rgba(26, 46, 74, 0.06), -1px 0 0 rgba(26, 46, 74, 0.06); }
.card-no { font-family: var(--font-cond); font-weight: 600; font-size: 64px; line-height: 0.9; letter-spacing: -0.01em; margin-bottom: 14px; }
.card-title { font-family: var(--font-serif); font-weight: 700; font-size: 21px; line-height: 1.35; letter-spacing: 0.03em; font-feature-settings: "palt"; }
.card-en { font-family: var(--font-cond); font-weight: 500; font-size: 13.5px; letter-spacing: 0.14em; text-transform: uppercase; margin-top: 4px; opacity: 0.8; }
.card-desc { font-size: 13.5px; line-height: 1.7; margin-top: 10px; }
.card-foot { margin-top: auto; padding-top: 14px; display: flex; align-items: center; justify-content: space-between; font-size: 13px; border-top: 1px solid currentColor; border-top-color: color-mix(in srgb, currentColor 22%, transparent); }
.card-foot svg { width: 18px; height: 18px; }

.v1 { --card-bg: var(--paper-hi); background: var(--paper-hi) repeating-linear-gradient(to bottom, transparent 0 27px, rgba(0, 111, 106, 0.07) 27px 28px) 0 64px / 100% calc(100% - 64px) no-repeat; color: var(--navy); }
.v1::before { content: ""; position: absolute; left: 14px; top: 0; bottom: 0; width: 1px; background: rgba(0, 182, 190, 0.45); }
.v1 .card-no, .v1 .card-tab { color: var(--teal); }
.v2 { --card-bg: var(--teal); background: var(--teal); color: #fff; }
.v2 .card-en { opacity: 0.85; }
.v3 { --card-bg: #f6fbfa; background: #f6fbfa; color: var(--navy); }
.v3 .card-no { color: var(--teal); }
.v3 .clip { position: absolute; top: -18px; left: 22px; width: 18px; height: 48px; color: #7d8a92; z-index: 2; }
.v4 { --card-bg: var(--navy); background: var(--navy); color: #fff; }
.v4 .card-no { color: var(--aqua); }
.v4 .card-tab { color: var(--navy); --card-bg: var(--aqua); }
.v4 .tape { position: absolute; top: -10px; left: 50%; width: 92px; height: 22px; transform: translateX(-50%) rotate(-3deg); background: rgba(0, 182, 190, 0.35); box-shadow: 0 0 0 1px rgba(0, 182, 190, 0.2); z-index: 2; }
.v5 { --card-bg: var(--mint-2); background: var(--mint-2); color: var(--navy); }
.v5 .card-no { color: var(--teal-dk); }
.v6 { --card-bg: var(--paper-2); background: var(--paper-2); color: var(--navy); }
.v6 .card-no { color: var(--teal); }

/* pin-04：發牌。只有 JS 在、而且沒有要求減少動態時，才先疊在資料夾裡 */
.js.deal-pending [data-deal] .chapter-card { opacity: 0; transform: translate(var(--sx, 0px), var(--sy, 120px)) rotate(0deg) scale(0.94); transition: none; }
.js.deal-run [data-deal] .chapter-card {
  transition: transform 0.65s var(--ease-out), opacity 0.4s var(--ease-out);
  transition-delay: calc(var(--i) * 70ms);
}

/* ---------- 首頁：索引卡目錄（pin-13） ---------- */
.index-section { max-width: 1380px; margin: 0 auto; padding: 56px var(--gutter) 24px; }
.index-card { position: relative; background: var(--paper-hi); border-radius: 8px; box-shadow: var(--paper-shadow); padding: 0 0 26px; }
.index-card::before { content: ""; position: absolute; left: 36px; top: -14px; width: 160px; height: 16px; background: var(--paper-hi); border-radius: 10px 10px 0 0; box-shadow: 0 -1px 0 rgba(26, 46, 74, 0.08); }
.index-head { padding: 30px 40px 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 28px; align-items: end; }
.index-head h2 { margin: 0; font-family: var(--font-serif); font-size: 30px; line-height: 1.2; color: var(--navy); letter-spacing: 0.06em; }
.index-head h2 .en { display: block; font-family: var(--font-cond); font-weight: 600; font-size: 15px; letter-spacing: 0.24em; color: var(--teal); margin-bottom: 6px; }
.index-head p { margin: 0; color: var(--ink-2); font-size: 14.5px; }
.index-colhead { grid-column: 1 / -1; display: flex; justify-content: space-between; margin-top: 18px; padding: 6px 0; border-top: 2px solid var(--navy); border-bottom: 1px solid var(--line); font-family: var(--font-cond); font-size: 13px; letter-spacing: 0.12em; color: var(--ink-2); }
.index-cols { padding: 18px 40px 0; column-count: 3; column-gap: 44px; }
.index-ch { break-inside: avoid; margin: 0 0 22px; }
.index-ch > summary { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; list-style: none; margin: 0 0 4px; }
.index-ch > summary::-webkit-details-marker { display: none; }
.index-ch h3 { margin: 0; font-size: 14px; letter-spacing: 0.06em; color: var(--teal); display: flex; align-items: baseline; gap: 8px; }
.index-count { font-size: 12.5px; color: var(--ink-2); }
@media (min-width: 761px) { .index-ch > summary { pointer-events: none; } .index-count { display: none; } }
.index-ch h3 .no { font-size: 18px; }
.index-list { list-style: none; margin: 0; padding: 0; }
.index-list li { position: relative; }
.index-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  padding: 7px 2px 7px 0; border-bottom: 1px solid var(--line-2);
  color: var(--navy); text-decoration: none; font-size: 15px; line-height: 1.5;
  transform-origin: left center;
  transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}
.index-meta { flex: none; font-family: var(--font-cond); font-size: 14px; color: var(--ink-2); letter-spacing: 0.04em; }
.index-desc {
  position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 5;
  padding: 10px 12px; border-radius: 6px; background: var(--navy); color: #fff; font-size: 13.5px; line-height: 1.65;
  box-shadow: var(--paper-shadow-lift); pointer-events: none;
  opacity: 0; transform: translateY(-4px);
  transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}
.index-desc::before { content: ""; position: absolute; top: -5px; left: 18px; width: 10px; height: 10px; background: var(--navy); transform: rotate(45deg); }
/* 滑過那一行：變深、放大，其他行變淡 */
@media (hover: hover) {
  .index-cols:hover .index-row { opacity: 0.32; }
  .index-cols .index-list li:hover .index-row { opacity: 1; transform: scale(1.035); }
  .index-cols .index-list li:hover .index-desc { opacity: 1; transform: none; }
}
/* 只有「索引列」被鍵盤聚焦時才淡化其他列；點章節標題（summary）不算 */
.index-cols:has(.index-row:focus-visible) .index-row { opacity: 0.32; }
.index-cols .index-row:focus-visible { opacity: 1; transform: scale(1.035); outline-offset: 2px; }
.index-cols .index-row:focus-visible + .index-desc { opacity: 1; transform: none; }
/* 手機：點一下聚焦（JS 加上 is-focus），再點一次打開 */
.index-cols.has-focus .index-row { opacity: 0.32; }
.index-cols.has-focus li.is-focus .index-row { opacity: 1; transform: scale(1.03); }
.index-cols.has-focus li.is-focus .index-desc { opacity: 1; transform: none; }
.index-cols.has-focus li.is-focus .index-desc::after { content: "　再點一次標題打開 →"; color: var(--aqua-tint); }

/* ---------- 首頁：前言 ---------- */
.about { padding: 64px var(--gutter) 40px; }
.about-inner { max-width: 760px; margin: 0 auto; }
.section-kicker { margin: 0 0 6px; color: var(--teal); font-size: 14px; letter-spacing: 0.1em; display: flex; gap: 8px; align-items: baseline; }
.section-kicker .no { font-size: 18px; }
.about-title { margin: 0 0 24px; font-family: var(--font-serif); font-size: 34px; line-height: 1.35; color: var(--navy); letter-spacing: 0.04em; }

/* 底部固定導覽 */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-between;
  padding: 0 var(--gutter) env(safe-area-inset-bottom);
  background: rgba(251, 249, 244, 0.96); border-top: 1px solid var(--line);
}
.dock a { flex: 1; text-align: center; padding: 13px 0 14px; color: var(--navy); text-decoration: none; font-size: 18px; letter-spacing: 0.12em; }
.dock a:first-child { text-align: left; }
.dock a:last-child { text-align: right; }
.dock a:hover { color: var(--teal); }

/* ---------- 內文頁 ---------- */
.progress { position: fixed; left: 0; right: 0; top: var(--topbar-h); height: 3px; z-index: 41; pointer-events: none; }
.progress span { display: block; height: 100%; background: var(--aqua); transform-origin: left; transform: scaleX(0); }
.read-layout {
  max-width: 1360px; margin: 0 auto; padding: 36px var(--gutter) 64px;
  display: grid; grid-template-columns: 236px minmax(0, 720px) 220px; gap: 56px; justify-content: center;
}
.sidenav, .toc { position: sticky; top: calc(var(--topbar-h) + 28px); align-self: start; max-height: calc(100vh - var(--topbar-h) - 48px); overflow: auto; scrollbar-width: thin; }
.side-chapter { display: flex; gap: 10px; align-items: baseline; padding: 10px 14px; margin-bottom: 14px; background: var(--mint); border-radius: 10px 10px 4px 4px; color: var(--navy); text-decoration: none; font-family: var(--font-serif); font-weight: 700; font-size: 15.5px; line-height: 1.45; box-shadow: inset 0 0 0 1px rgba(0, 111, 106, 0.14); }
.side-chapter .no { color: var(--teal); font-family: var(--font-cond); font-size: 18px; }
.sidenav ol { list-style: none; margin: 0 0 10px; padding: 0; }
.sidenav li a { display: block; padding: 6px 10px 6px 14px; color: var(--ink); text-decoration: none; font-size: 14px; line-height: 1.55; border-left: 2px solid var(--line-2); }
.sidenav li a:hover { color: var(--navy); border-left-color: var(--mint-3); }
.sidenav li a[aria-current] { color: var(--navy); font-weight: 700; border-left-color: var(--teal); background: linear-gradient(90deg, rgba(0, 111, 106, 0.07), transparent); }
.sidenav .date { font-family: var(--font-cond); font-weight: 600; color: var(--teal); margin-right: 6px; }
.side-group { margin: 14px 0 4px; font-size: 12.5px; letter-spacing: 0.14em; color: var(--ink-2); }

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13.5px; color: var(--ink-2); margin-bottom: 18px; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--teal); text-decoration: underline; }
.read-head h1 { margin: 0; font-family: var(--font-serif); font-weight: 700; font-size: clamp(30px, 3.1vw, 40px); line-height: 1.35; letter-spacing: 0.03em; color: var(--navy); font-feature-settings: "palt"; }
.read-head .lead { margin: 14px 0 0; font-size: 18px; line-height: 1.8; color: var(--ink-2); }
.read-head { padding-bottom: 26px; margin-bottom: 30px; border-bottom: 1px solid var(--line); }

.toc-label { margin: 2px 0 10px; font-size: 12.5px; letter-spacing: 0.16em; color: var(--ink-2); }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc-list > li > a { display: block; position: relative; padding: 5px 0 5px 14px; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); text-decoration: none; border-left: 2px solid var(--line-2); }
.toc-list ol a { display: block; padding: 3px 0 3px 26px; font-size: 12.5px; color: var(--ink-2); text-decoration: none; border-left: 2px solid var(--line-2); }
.toc a:hover { color: var(--navy); }
.toc a.is-active { color: var(--navy); font-weight: 700; border-left-color: var(--aqua); }
.toc-top { display: inline-flex; align-items: center; gap: 4px; margin-top: 18px; font-size: 13px; color: var(--teal); text-decoration: none; }
.toc-top svg { width: 15px; height: 15px; }
.toc-inline { display: none; }

/* 內文排版：好讀第一 */
.prose { font-size: 17px; line-height: 1.9; letter-spacing: 0.02em; color: var(--ink); }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.15em; text-align: justify; }
.prose h2 { position: relative; margin: 2.4em 0 0.8em; padding-top: 18px; font-family: var(--font-serif); font-weight: 700; font-size: 25px; line-height: 1.45; color: var(--navy); letter-spacing: 0.03em; font-feature-settings: "palt"; }
.prose h2::before { content: ""; position: absolute; left: 0; top: 0; width: 28px; height: 3px; border-radius: 2px; background: var(--aqua); }
.prose h3 { margin: 1.9em 0 0.6em; font-size: 18.5px; line-height: 1.55; color: var(--navy); }
.prose h2 .tag, .prose h3 .tag { vertical-align: 3px; margin-left: 8px; }
.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.4em; }
.prose li { margin: 0.3em 0; }
.prose li::marker { color: var(--teal); }
.prose strong { color: var(--navy); font-weight: 700; }
.prose a { color: var(--teal); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; text-decoration-color: rgba(0, 111, 106, 0.4); }
.prose a:hover { text-decoration-color: currentColor; }
.prose a.ext::after { content: "↗"; font-size: 0.78em; margin-left: 2px; text-decoration: none; display: inline-block; }
.prose blockquote { margin: 1.4em 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--mint-3); color: var(--ink-2); }
.prose code { font-size: 0.9em; background: var(--paper-2); padding: 1px 5px; border-radius: 4px; }

/* 表格：紙上的格線 */
.table-wrap { margin: 1.4em 0 1.6em; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 6px; background: var(--paper-hi); box-shadow: var(--paper-edge); }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.7; letter-spacing: 0.01em; }
.prose th { text-align: left; font-weight: 700; color: var(--navy); background: var(--mint); padding: 10px 14px; border-bottom: 2px solid var(--teal); white-space: nowrap; }
.prose td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.prose tr:last-child td { border-bottom: 0; }
.prose td:first-child { color: var(--navy); font-weight: 500; }
.prose table.kv thead { display: none; }
.prose table.kv td:first-child { width: 28%; white-space: nowrap; color: var(--teal); font-weight: 700; background: rgba(233, 248, 245, 0.55); }

/* 提示框：索引卡 */
.note { position: relative; margin: 1.5em 0; padding: 18px 22px 8px 24px; border-radius: 4px 10px 10px 4px; background: var(--paper-hi); box-shadow: var(--paper-edge), 0 6px 16px -14px rgba(26, 46, 74, 0.4); border-left: 4px solid var(--teal); }
.note ul, .note ol { padding-left: 1.25em; }
.note p.note-label { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 14px; font-weight: 700; letter-spacing: 0.1em; color: var(--teal); text-align: left; }
.note-label::before { content: ""; flex: none; width: 18px; height: 18px; border-radius: 50%; background: currentColor; -webkit-mask: var(--ico) center / 18px no-repeat; mask: var(--ico) center / 18px no-repeat; }
.note-info { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 1a9 9 0 1 0 0 18 9 9 0 0 0 0-18Zm1 14H9V9h2Zm0-8H9V5h2Z'/%3E%3C/svg%3E"); background: #f3faf8; }
.note-success { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 1a9 9 0 1 0 0 18 9 9 0 0 0 0-18Zm-1.2 13.2L4.6 10l1.4-1.4 2.8 2.8 5.2-5.2 1.4 1.4Z'/%3E%3C/svg%3E"); background: var(--mint); border-left-color: var(--teal-dk); }
.note-warning { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 1 0.5 18h19Zm1 14H9v-2h2Zm0-4H9V7h2Z'/%3E%3C/svg%3E"); border-left-color: var(--navy); }
.note-warning p.note-label { color: var(--navy); }
.note-warning .note-label::before { border-radius: 0; }
.note-danger { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 1 0.5 18h19Zm1 14H9v-2h2Zm0-4H9V7h2Z'/%3E%3C/svg%3E"); background: var(--danger-tint); border-left-color: var(--danger); }
.note-danger p.note-label { color: var(--danger); }
.note-danger .note-label::before { border-radius: 0; }

/* 資訊標籤 */
.tag { display: inline-block; font-size: 0.78em; line-height: 1.55; padding: 0 8px; margin: 0 2px; border-radius: 999px; white-space: nowrap; letter-spacing: 0.02em; font-weight: 500; vertical-align: 1px; text-indent: 0; }
.tag-recheck { background: var(--aqua-tint); color: var(--navy); box-shadow: inset 0 0 0 1px rgba(0, 182, 190, 0.45); }
.tag-source { color: var(--teal); box-shadow: inset 0 0 0 1px rgba(0, 111, 106, 0.35); }
.tag-editor { color: var(--navy); box-shadow: inset 0 0 0 1px rgba(26, 46, 74, 0.45); border-radius: 4px; }
mark.flag { background: rgba(0, 182, 190, 0.1); color: var(--navy); padding: 1px 3px 2px 0; border-bottom: 1.5px dashed rgba(0, 111, 106, 0.7); border-radius: 4px 4px 0 0; }
.flag-label { display: inline-block; margin-right: 6px; padding: 0 7px; border-radius: 4px; background: var(--navy); color: #fff; font-size: 0.76em; line-height: 1.7; letter-spacing: 0.06em; vertical-align: 1px; }

/* 圖片待補 */
figure.placeholder { margin: 1.6em 0; padding: 26px 22px; border-radius: 6px; border: 1.5px dashed var(--mint-3); background: repeating-linear-gradient(135deg, transparent 0 10px, rgba(0, 111, 106, 0.04) 10px 11px), var(--paper-hi); text-align: center; }
.placeholder-label { display: inline-block; font-size: 13px; letter-spacing: 0.12em; color: var(--teal); border: 1px solid var(--mint-3); border-radius: 999px; padding: 0 10px; margin-bottom: 8px; background: var(--mint); }
figure.placeholder figcaption { font-size: 14.5px; line-height: 1.7; color: var(--ink-2); }

/* 頁尾資料狀態 */
footer.page-meta { margin-top: 2.6em; padding: 14px 18px; border-top: 1px dashed var(--mint-3); background: rgba(233, 248, 245, 0.45); border-radius: 0 0 8px 8px; font-size: 14px; line-height: 1.75; color: var(--ink-2); }
footer.page-meta p { margin: 0; text-align: left; }

/* 上一頁／下一頁 */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 48px; }
.pager a { display: flex; flex-direction: column; gap: 4px; padding: 16px 20px 18px; border-radius: 8px; background: var(--paper-hi); box-shadow: var(--paper-edge); color: var(--navy); text-decoration: none; }
.pager a:hover { box-shadow: 0 0 0 1px var(--mint-3), 0 8px 20px -16px rgba(26, 46, 74, 0.5); }
.pager-next { text-align: right; align-items: flex-end; }
.pager-dir { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--teal); letter-spacing: 0.08em; }
.pager-dir svg { width: 16px; height: 16px; }
.pager-title { font-family: var(--font-serif); font-weight: 700; font-size: 17px; line-height: 1.5; }
.pager-ch { font-size: 12.5px; color: var(--ink-2); }

.to-top { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 30; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--navy); color: #fff; box-shadow: var(--paper-shadow); opacity: 0; pointer-events: none; transition: opacity 0.3s var(--ease-out); }
.to-top svg { width: 20px; height: 20px; }
.to-top.is-shown { opacity: 1; pointer-events: auto; }
.no-js .to-top { opacity: 1; pointer-events: auto; }

@media (max-width: 1240px) {
  .read-layout { grid-template-columns: minmax(0, 720px) 210px; gap: 48px; }
  .sidenav { display: none; }
}
@media (max-width: 960px) {
  .read-layout { grid-template-columns: minmax(0, 1fr); padding-top: 22px; max-width: 760px; }
  .toc { display: none; }
  .toc-inline { display: block; margin: 0 0 28px; border-radius: 8px; background: var(--paper-hi); box-shadow: var(--paper-edge); }
  .toc-inline summary { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; cursor: pointer; color: var(--navy); font-weight: 700; font-size: 15px; list-style: none; }
  .toc-inline summary::-webkit-details-marker { display: none; }
  .toc-inline summary span { font-weight: 400; font-size: 13px; color: var(--ink-2); margin-left: auto; }
  .toc-inline summary::after { content: "＋"; color: var(--teal); margin-left: 8px; }
  .toc-inline[open] summary::after { content: "－"; }
  .toc-inline ol { list-style: none; margin: 0; padding: 0 16px 12px; }
  .toc-inline > ol { border-top: 1px solid var(--line-2); padding-top: 8px; }
  .toc-inline a { display: block; padding: 6px 0; color: var(--ink); text-decoration: none; font-size: 15px; }
  .toc-inline ol ol a { padding-left: 14px; font-size: 14px; color: var(--ink-2); }
}
@media (max-width: 560px) {
  .prose { font-size: 16.5px; line-height: 1.88; }
  .prose h2 { font-size: 22px; }
  .prose h3 { font-size: 17.5px; }
  .read-head .lead { font-size: 16.5px; }
  .prose table { font-size: 14.5px; }
  .prose th, .prose td { padding: 9px 11px; }
  .prose table.kv td:first-child { white-space: normal; width: 30%; }
  .note { padding: 16px 16px 6px 18px; }
  .pager { grid-template-columns: 1fr; }
  .pager-next { text-align: left; align-items: flex-start; }
  .to-top { width: 42px; height: 42px; }
}

/* ---------- 章節開頭 ---------- */
.chapter { max-width: 1240px; margin: 0 auto; padding: 48px var(--gutter) 72px; }
.ch-head { position: relative; padding: 52px 48px 40px; border-radius: 6px 18px 12px 12px; background: var(--mint-2); box-shadow: inset 0 0 0 1px rgba(0, 111, 106, 0.16); margin-top: 30px; }
.ch-folder-tab { position: absolute; left: 0; top: -32px; height: 34px; padding: 0 22px; display: flex; align-items: center; border-radius: 14px 18px 0 0; background: var(--mint-2); font-family: var(--font-cond); font-weight: 600; font-size: 15px; letter-spacing: 0.16em; color: var(--teal-dk); box-shadow: inset 1px 1px 0 rgba(0, 111, 106, 0.16), inset -1px 0 0 rgba(0, 111, 106, 0.16); }
.ch-en { margin: 0; font-family: var(--font-cond); font-weight: 600; font-size: 16px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--teal); }
.ch-head h1 { margin: 6px 0 0; display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; font-family: var(--font-serif); font-weight: 700; font-size: clamp(32px, 4vw, 48px); line-height: 1.25; color: var(--navy); letter-spacing: 0.04em; }
.ch-no { font-family: var(--font-cond); font-weight: 600; font-size: 1.6em; line-height: 0.9; color: var(--teal); letter-spacing: 0; }
.ch-desc { margin: 16px 0 0; max-width: 40em; font-size: 17px; line-height: 1.8; color: var(--ink); }
.ch-count { margin: 10px 0 0; font-size: 14px; color: var(--ink-2); }
.ch-body { margin-top: 40px; }
.ch-group { margin-bottom: 36px; }
.ch-group-label { margin: 0 0 18px; font-size: 16px; }
.divider-tab { display: inline-block; padding: 4px 18px; border-radius: 10px 10px 0 0; background: var(--navy); color: #fff; letter-spacing: 0.2em; }
.page-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.page-card { background: var(--paper-hi); --rot: 0deg; transform: rotate(var(--rot)); transition: transform 0.32s var(--ease-out), box-shadow 0.32s var(--ease-out); }
.page-card:nth-child(3n + 1) { --rot: -0.8deg; }
.page-card:nth-child(3n + 2) { --rot: 0.6deg; }
.page-card:nth-child(3n) { --rot: -0.4deg; }
.page-card:hover, .page-card:focus-within { transform: translateY(-10px) rotate(0deg); box-shadow: var(--paper-shadow-lift); z-index: 2; }
.page-card > a { padding: 20px 22px 18px; gap: 6px; border-top: 4px solid var(--teal); }
.page-no { font-family: var(--font-cond); font-weight: 600; font-size: 15px; color: var(--teal); letter-spacing: 0.08em; }
.date-dot { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; border: 1.5px solid var(--teal); font-family: var(--font-cond); font-weight: 600; font-size: 17px; color: var(--teal); margin-bottom: 4px; }
.page-title { font-family: var(--font-serif); font-weight: 700; font-size: 19px; line-height: 1.45; color: var(--navy); }
.page-desc { font-size: 14.5px; line-height: 1.75; color: var(--ink); }
.page-go { margin-top: auto; padding-top: 8px; color: var(--teal); display: flex; justify-content: flex-end; }
.page-go svg { width: 20px; height: 20px; }
.ch-pager { max-width: 760px; margin-left: auto; margin-right: auto; }

/* ---------- 搜尋 ---------- */
dialog.search { width: min(680px, calc(100vw - 24px)); max-height: min(78vh, 720px); margin: 10vh auto auto; padding: 0; border: 0; border-radius: 12px; background: var(--paper-hi); color: var(--ink); box-shadow: var(--paper-shadow-lift); }
dialog.search::backdrop { background: rgba(26, 46, 74, 0.38); }
.search-form { display: flex; gap: 8px; padding: 14px; border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: var(--paper-hi); }
.search-field { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 12px; border-radius: 8px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.search-field svg { width: 18px; height: 18px; color: var(--teal); flex: none; }
.search-field input { flex: 1; min-width: 0; height: 44px; border: 0; background: transparent; font: inherit; font-size: 16px; color: var(--navy); outline: none; }
.search-close { border: 1px solid var(--line); background: var(--paper-hi); border-radius: 8px; padding: 0 12px; font: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.search-status { margin: 10px 18px 4px; font-size: 13px; color: var(--ink-2); }
.search-results { list-style: none; margin: 0; padding: 4px 8px 12px; overflow: auto; max-height: calc(min(78vh, 720px) - 120px); }
.search-results a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--mint); }
.search-results .r-title { display: block; color: var(--navy); font-weight: 700; font-size: 15.5px; }
.search-results .r-ch { font-family: var(--font-cond); font-size: 13px; color: var(--teal); margin-left: 8px; font-weight: 600; }
.search-results .r-snip { display: block; font-size: 13.5px; line-height: 1.7; color: var(--ink-2); margin-top: 2px; }
.search-results mark { background: var(--aqua-tint); color: var(--navy); border-radius: 3px; padding: 0 1px; }
.search-page { max-width: 760px; margin: 0 auto; padding: 48px var(--gutter) 72px; }
.search-page h1 { font-family: var(--font-serif); color: var(--navy); }
.search-all { padding-left: 1.4em; }
.search-all li { margin: 8px 0; }
.search-all span { display: block; font-size: 14px; color: var(--ink-2); }

/* ---------- 頁尾 ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--paper-2); }
.site-footer-inner { max-width: 1240px; margin: 0 auto; padding: 30px var(--gutter) 40px; font-size: 13.5px; line-height: 1.8; color: var(--ink-2); }
.site-footer p { margin: 0 0 4px; }
.foot-title { font-family: var(--font-serif); font-weight: 700; color: var(--navy); font-size: 16px; }
.foot-title span { font-family: var(--font-cond); color: var(--teal); }
.foot-small { margin-top: 10px !important; font-size: 12.5px; }
.foot-parent .parent-link { padding: 0; color: var(--teal); font-size: inherit; line-height: inherit; }
.foot-source a { color: var(--teal); text-underline-offset: 3px; overflow-wrap: anywhere; }

/* ---------- 首頁：平板與手機 ---------- */
@media (max-width: 1180px) {
  .desk-grid { grid-template-columns: minmax(0, 1fr); padding: 44px 32px 36px; }
  .cover-card { max-width: 640px; }
  .index-cols { column-count: 2; }
}
@media (max-width: 760px) {
  .desk { padding: 40px 12px 28px; }
  .folder { inset: 40px 12px 28px; }
  .folder-tab { font-size: 12px; letter-spacing: 0.12em; padding: 0 14px; gap: 8px; }
  .folder-front { top: 340px; }
  .desk-grid { padding: 36px 12px 22px; gap: 30px; }
  .cover-card { padding: 34px 22px 24px; transform: rotate(-0.6deg); }
  .cover-card h1 { font-size: 54px; }
  .cover-en { font-size: 15px; }
  .cover-kicker span { display: block; }
  .cover-kicker .sep { display: none; }
  .cover-lead { font-size: 15.5px; margin: 16px 0 22px; }
  .chapter-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; }
  .chapter-card { min-height: 0; }
  .chapter-card:nth-child(odd) { --rot: -1.2deg; }
  .chapter-card:nth-child(even) { --rot: 1.2deg; --dy: 8px; }
  .chapter-card > a { padding: 14px 13px 12px; }
  .card-no { font-size: 44px; margin-bottom: 8px; }
  .card-title { font-size: 17px; }
  .card-en { font-size: 12px; letter-spacing: 0.1em; }
  .card-desc { font-size: 13px; line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .card-tab { right: 12px; font-size: 11.5px; }
  .v1 { background-position: 0 52px; background-size: 100% calc(100% - 52px); }
  .v1::before { left: 8px; }
  .index-section { padding: 40px 12px 16px; }
  .index-head { padding: 24px 18px 0; grid-template-columns: 1fr; }
  .index-head h2 { font-size: 26px; }
  .index-cols { column-count: 1; padding: 8px 18px 0; }
  .index-ch { margin: 0; border-bottom: 1px solid var(--line); }
  .index-ch > summary { padding: 14px 0; margin: 0; cursor: pointer; }
  .index-ch > summary::after { content: "＋"; color: var(--teal); margin-left: 10px; }
  .index-ch[open] > summary::after { content: "－"; }
  .index-ch h3 { font-size: 15.5px; flex: 1; }
  .index-ch .index-list { padding-bottom: 12px; }
  .index-row { font-size: 15px; padding: 10px 0; }
  .about { padding: 48px 16px 32px; }
  .about-title { font-size: 28px; }
  .dock a { font-size: 16px; letter-spacing: 0.08em; }
  .ch-head { padding: 40px 20px 28px; }
  .page-cards { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .page-card:nth-child(n) { --rot: 0deg; }
}
@media (min-width: 761px) and (max-width: 1100px) { .page-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- 減少動態 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .chapter-card:hover, .chapter-card:focus-within { transform: translateY(var(--dy)) rotate(var(--rot)); }
  .page-card:hover, .page-card:focus-within { transform: rotate(var(--rot)); }
  .index-cols .index-list li:hover .index-row, .index-cols .index-row:focus-visible, .index-cols.has-focus li.is-focus .index-row { transform: none; }
}

/* ---------- 列印 ---------- */
@media print {
  @page { margin: 18mm 16mm; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .parent-bar, .topbar, .progress, .sidenav, .toc, .toc-inline, .pager, .to-top, .dock, .site-footer, dialog.search, .skip, .crumbs { display: none !important; }
  .read-layout { display: block; padding: 0; max-width: none; }
  .read-head { border-color: #999; }
  .prose { font-size: 11pt; line-height: 1.75; color: #000; }
  .prose h2 { break-after: avoid; }
  .prose a { color: #000; text-decoration: underline; }
  .prose a.ext::after { content: " (" attr(href) ")"; font-size: 9pt; color: #444; }
  .table-wrap { overflow: visible; box-shadow: none; border: 1px solid #bbb; }
  .prose table { font-size: 9.5pt; }
  .prose tr, .note, figure { break-inside: avoid; }
  .note { box-shadow: none; border: 1px solid #bbb; border-left-width: 4px; }
  .home .desk, .home .index-section { display: none; }
}
