/* 115 社團評鑑網站：黑底金字，延續評鑑資料封面風格 */
:root {
  --bg: #0b0b0b;
  --bg-2: #121110;
  --panel: #161410;
  --line: #2a261e;
  --line-2: #3a3326;
  --text: #ece7db;
  --text-2: #bdb6a6;
  --muted: #8f8776;
  --gold: #c9a96a;
  --gold-2: #e2c88f;
  --gold-dim: rgba(201, 169, 106, .14);
  --paper: #f4f1ea;
  --serif: "Noto Serif TC", "Source Han Serif TC", "Songti TC", "PMingLiU", "MingLiU", serif;
  --sans: -apple-system, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
  --top: 60px;
  --side: 284px;
  --radius: 6px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- 頂端列 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--top);
  display: flex; align-items: center; gap: 28px;
  padding: 0 20px;
  background: rgba(11, 11, 11, .92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.brand-mark { font-family: var(--serif); font-weight: 700; letter-spacing: .14em; font-size: 15px; }
.brand-sub { color: var(--gold); font-size: 13px; letter-spacing: .08em; }
.mainnav { display: flex; gap: 4px; }
.mainnav a {
  padding: 8px 12px; border-radius: 4px; color: var(--text-2); font-size: 14px; white-space: nowrap;
  min-height: 40px; display: inline-flex; align-items: center;
}
.mainnav a:hover { color: var(--text); background: var(--panel); }
.mainnav a.on { color: var(--gold); }

.search { position: relative; margin-left: auto; width: min(380px, 40vw); }
.search input {
  width: 100%; height: 40px;
  padding: 0 36px 0 38px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 20px;
  font: inherit; font-size: 14px;
  -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--gold); }
.search-icon { position: absolute; left: 13px; top: 11px; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; }
.search-kbd {
  position: absolute; right: 12px; top: 10px;
  font-family: var(--sans); font-size: 11px; color: var(--muted);
  border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; line-height: 18px;
}
.search input:focus ~ .search-kbd { display: none; }

/* ---------- 共用 ---------- */
main { outline: none; }
.chip {
  display: inline-flex; align-items: center;
  padding: 1px 10px; border: 1px solid var(--line-2); border-radius: 999px;
  font-size: 12px; color: var(--text-2); white-space: nowrap;
}
.chip.gold { color: var(--gold); border-color: rgba(201, 169, 106, .45); }
.muted { color: var(--muted); }
.serif { font-family: var(--serif); }
.num { color: var(--gold); font-family: var(--serif); font-variant-numeric: lining-nums; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; min-width: 40px; padding: 0 12px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 4px;
  cursor: pointer; font-size: 14px; color: var(--text);
}
.btn:hover { border-color: var(--gold); color: var(--gold); }
.btn:disabled { opacity: .35; cursor: default; border-color: var(--line-2); color: var(--text); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.empty { padding: 80px 24px; text-align: center; color: var(--text-2); }
.empty h2 { font-family: var(--serif); color: var(--text); }

/* ---------- 資料頁 ---------- */
.docpage {
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
  height: calc(100vh - var(--top));
  height: calc(100dvh - var(--top));
}
.sidebar {
  border-right: 1px solid var(--line);
  overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 0 40px;
  background: var(--bg);
}
.sidebar h3 {
  margin: 18px 20px 6px; font-family: var(--serif); font-size: 14px; font-weight: 700;
  color: var(--gold); letter-spacing: .04em;
}
.sidebar h3 a:hover { color: var(--gold-2); }
.sidebar h3 .n { margin-right: 6px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a {
  display: flex; gap: 8px; align-items: baseline;
  padding: 7px 20px 7px 22px; font-size: 13.5px; color: var(--text-2);
  border-left: 2px solid transparent; line-height: 1.45;
}
.sidebar li a:hover { color: var(--text); background: var(--bg-2); }
.sidebar li a.on { color: var(--text); border-left-color: var(--gold); background: var(--gold-dim); }
.sidebar li a .d { color: var(--gold); font-size: 12px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.sidebar li a.minor { color: var(--muted); font-size: 12.5px; }

.docmain { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.dochead { padding: 14px 24px 12px; border-bottom: 1px solid var(--line); }
.crumbs { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.crumbs a:hover { color: var(--gold); }
.crumbs .sep { opacity: .6; }
.doctitle { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 4px; }
.doctitle h1 { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 700; letter-spacing: .02em; }
.docmeta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.docsummary { margin: 2px 0 0; color: var(--text-2); font-size: 14px; max-width: 80ch; }
.doclinks { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

.toolbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--bg-2);
}
.toolbar .grow { flex: 1; }
.pageinput { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-2); }
.pageinput input {
  width: 56px; height: 36px; text-align: center;
  background: var(--bg); color: var(--text); border: 1px solid var(--line-2); border-radius: 4px; font: inherit;
}
.progress { font-size: 13px; color: var(--muted); min-width: 0; }
.progress-bar { height: 2px; background: var(--line); position: relative; overflow: hidden; }
.progress-bar i { position: absolute; inset: 0 auto 0 0; background: var(--gold); width: 0; transition: width .2s; }

.viewer { flex: 1; min-height: 0; position: relative; background: #1c1b19; }
.pdf-scroll { position: absolute; inset: 0; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.pdf-pages { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px; min-width: min-content; }
.pdf-page {
  position: relative; background: var(--paper); box-shadow: 0 2px 14px rgba(0, 0, 0, .5);
  flex-shrink: 0;
}
.pdf-page::after {
  content: attr(data-page); position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  color: #b9b2a3; font-family: var(--serif); font-size: 28px;
}
.pdf-page.ready::after { content: none; }
.pdf-page canvas { display: block; width: 100%; height: 100%; }
.viewer-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-2); text-align: center; padding: 24px; }

.docfoot {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 16px; border-top: 1px solid var(--line); background: var(--bg-2); font-size: 13.5px;
}
.docfoot a { display: inline-flex; gap: 6px; align-items: center; color: var(--text-2); min-height: 36px; max-width: 48%; }
.docfoot a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docfoot a:hover { color: var(--gold); }
.docfoot svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.docfoot .next { margin-left: auto; text-align: right; }

.toc-toggle { display: none; }
.scrim { display: none; }

/* 全螢幕：只留檢視器 */
.docmain:fullscreen { background: var(--bg); }
.docmain:fullscreen .dochead, .docmain:fullscreen .docfoot { display: none; }

/* ---------- iPad 直向與較窄螢幕 ---------- */
@media (max-width: 1000px) {
  .topbar { gap: 14px; padding: 0 14px; }
  .brand-sub { display: none; }
  .search { width: auto; flex: 1; max-width: 360px; }
  .search-kbd { display: none; }
  .docpage { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 60; top: var(--top); bottom: 0; left: 0; width: min(320px, 86vw);
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 8px 0 30px rgba(0, 0, 0, .5);
  }
  .docpage.toc-open .sidebar { transform: none; }
  .docpage.toc-open .scrim { display: block; position: fixed; inset: var(--top) 0 0 0; z-index: 55; background: rgba(0, 0, 0, .5); }
  .toc-toggle { display: inline-flex; }
  .dochead { padding: 12px 16px 10px; }
  .doctitle h1 { font-size: 19px; }
}
@media (max-width: 640px) {
  .mainnav a[data-nav="section"] { display: none; }
  .mainnav a { padding: 8px 8px; }
  .brand-mark { letter-spacing: .06em; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- 搜尋 ---------- */
.search-pop {
  position: absolute; top: 48px; right: 0; width: min(560px, 92vw);
  max-height: min(70vh, 640px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .6); padding: 6px 0;
}
.sr { padding: 8px 0; border-bottom: 1px solid var(--line); }
.sr:last-of-type { border-bottom: 0; }
.sr-title { display: flex; justify-content: space-between; gap: 12px; padding: 4px 16px; font-family: var(--serif); font-weight: 700; }
.sr-title:hover, .sr-title:focus { color: var(--gold); }
.sr-sec { font-family: var(--sans); font-weight: 400; font-size: 12px; color: var(--muted); white-space: nowrap; }
.sr-hit { display: flex; gap: 10px; padding: 5px 16px; font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.sr-hit:hover, .sr-hit:focus { background: var(--gold-dim); color: var(--text); }
.sr-page { color: var(--gold); white-space: nowrap; font-size: 12.5px; padding-top: 1px; }
.sr-snip { min-width: 0; overflow-wrap: anywhere; }
mark { background: rgba(201, 169, 106, .3); color: var(--text); border-radius: 2px; padding: 0 1px; }
.sr-more { padding: 2px 16px 0 16px; font-size: 12.5px; color: var(--muted); }
.sr-all { display: block; padding: 10px 16px 6px; color: var(--gold); font-size: 13.5px; text-align: right; }
.sr-empty { padding: 18px 16px; color: var(--text-2); }

/* ---------- 一般頁面 ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 36px 24px 80px; }
.page.narrow { max-width: 860px; }
.eyebrow { margin: 0; color: var(--gold); font-size: 13px; letter-spacing: .18em; }
.page-title { margin: 4px 0 6px; font-family: var(--serif); font-size: 30px; letter-spacing: .02em; }
.sr-list { margin-top: 18px; border-top: 1px solid var(--line); }
.sr-list .sr { padding: 14px 0; }
.sr-list .sr-title, .sr-list .sr-hit, .sr-list .sr-more { padding-left: 0; padding-right: 0; }
.sr-list .sr-title { font-size: 18px; }

/* ---------- 首頁 ---------- */
.btn.gold { background: var(--gold); color: #17140e; border-color: var(--gold); font-weight: 600; }
.btn.gold:hover { background: var(--gold-2); color: #17140e; }
.btn.ghost { background: transparent; }
.home { max-width: 1240px; margin: 0 auto; padding: 0 24px 64px; animation: fade .3s ease both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.hero { position: relative; display: flex; align-items: center; min-height: 240px; padding: 36px 0 28px; overflow: hidden; }
.hero-band {
  position: absolute; top: 0; bottom: 0; right: 9%; width: 150px;
  background: linear-gradient(90deg, rgba(201,169,106,.0) 0%, rgba(201,169,106,.55) 35%, rgba(150,120,70,.35) 70%, rgba(201,169,106,0) 100%);
  filter: blur(.3px);
}
.hero::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 64px; transform: translateY(-50%);
  background: repeating-linear-gradient(180deg, rgba(201,169,106,.13) 0 1px, transparent 1px 16px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 45%, #000 80%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 45%, #000 80%, transparent);
}
.hero-text { position: relative; }
.hero h1 { margin: 6px 0 0; font-family: var(--serif); font-size: clamp(34px, 5vw, 54px); font-weight: 700; letter-spacing: .06em; line-height: 1.2; }
.hero-en { margin: 6px 0 0; font-family: Georgia, var(--serif); letter-spacing: .42em; color: var(--gold); font-size: 15px; }
.hero-en::before { content: ""; display: block; width: 44px; height: 1px; background: var(--gold); margin: 14px 0 12px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }

.hls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.hl {
  display: flex; flex-direction: column; gap: 2px; padding: 16px 18px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .15s, transform .15s;
}
.hl:hover { border-color: var(--gold); transform: translateY(-2px); }
.hl-num { font-size: 42px; line-height: 1.1; font-weight: 700; }
.hl-num small { font-size: 16px; margin-left: 4px; color: var(--gold); font-family: var(--sans); font-weight: 400; }
.hl-label { font-size: 15px; }
.hl-go { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.hl:hover .hl-go { color: var(--gold); }

.secs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.sec {
  position: relative; display: flex; flex-direction: column; gap: 2px; padding: 16px 18px 16px;
  border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, var(--bg-2), var(--bg));
  transition: border-color .15s;
}
.sec:hover { border-color: var(--gold); }
.sec-no { font-size: 26px; font-weight: 700; line-height: 1; }
.sec-title { font-family: var(--serif); font-size: 20px; font-weight: 700; margin-top: 6px; }
.sec-sub { font-size: 12.5px; color: var(--muted); }
.sec-items { display: flex; flex-direction: column; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-2); gap: 3px; }
.sec-items span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.strip { margin-top: 30px; }
.strip-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.strip-head h2 { margin: 0; font-family: var(--serif); font-size: 20px; }
.strip-head a { color: var(--gold); font-size: 14px; }
.strip-line {
  position: relative; display: flex; gap: 0; overflow-x: auto; margin-top: 14px; padding: 4px 0 10px;
  scrollbar-width: thin;
}
.strip-line::before { content: ""; position: absolute; left: 0; right: 0; top: 11px; height: 1px; background: var(--line-2); min-width: 100%; }
.strip-line a { position: relative; flex: 0 0 auto; width: 128px; padding-right: 10px; display: flex; flex-direction: column; gap: 2px; }
.strip-line .dot { width: 15px; height: 15px; border-radius: 50%; background: var(--bg); border: 2px solid var(--gold); margin-bottom: 6px; }
.strip-line a:hover .dot { background: var(--gold); }
.strip-line .d { color: var(--gold); font-size: 13px; font-variant-numeric: tabular-nums; }
.strip-line .t { font-size: 13px; color: var(--text-2); line-height: 1.4; }
.strip-line a:hover .t { color: var(--text); }

.social { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--line); }
.social h2 { margin: 0 0 10px; font-family: var(--serif); font-size: 18px; }

/* ---------- 清單 ---------- */
.jump { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 4px; }
.jump a { padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 13.5px; color: var(--text-2); }
.jump a:hover { border-color: var(--gold); color: var(--gold); }
.block { margin-top: 26px; scroll-margin-top: calc(var(--top) + 16px); }
.block-title { font-family: var(--serif); font-size: 20px; margin: 0 0 8px; }
.rows { border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 16px; align-items: start;
  padding: 14px 8px; border-bottom: 1px solid var(--line);
}
.row:hover { background: var(--bg-2); }
.row:hover .row-title { color: var(--gold); }
.row-date { color: var(--gold); font-size: 13.5px; font-variant-numeric: tabular-nums; padding-top: 2px; }
.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-title { font-family: var(--serif); font-weight: 700; font-size: 16.5px; }
.row-sum { color: var(--text-2); font-size: 13.5px; margin-top: 2px; }
.row-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; max-width: 260px; }
.row-pages { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.back { display: inline-block; color: var(--text-2); font-size: 14px; margin-bottom: 14px; }
.back:hover { color: var(--gold); }
.hl-big { margin: 0; font-family: var(--serif); font-size: 26px; }
.hl-big .num { font-size: 52px; font-weight: 700; }
.hl-big small { color: var(--gold); font-size: 18px; margin: 0 6px 0 4px; }

@media (max-width: 1000px) {
  .hls, .secs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-band { right: -20px; opacity: .6; }
  .row { grid-template-columns: 70px minmax(0, 1fr); }
  .row-meta { grid-column: 2; justify-content: flex-start; max-width: none; }
}
@media (max-width: 560px) {
  .home { padding: 0 16px 48px; }
  .page { padding: 24px 16px 64px; }
  .hls, .secs { grid-template-columns: minmax(0, 1fr); }
  .row { grid-template-columns: minmax(0, 1fr); }
  .row-meta { grid-column: 1; }
}

/* ---------- 時間軸 ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 8px; }
.fchip { padding: 7px 16px; min-height: 38px; display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 999px; font-size: 14px; color: var(--text-2); }
.fchip:hover { border-color: var(--gold); color: var(--text); }
.fchip.on { background: var(--gold); border-color: var(--gold); color: #17140e; font-weight: 600; }
.tl-sem { margin-top: 30px; }
.tl-semhead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--line-2); }
.tl-semhead .num { font-size: 22px; font-weight: 700; }
.tl-semhead > span:nth-child(2) { font-family: var(--serif); font-size: 17px; }
.tl-semhead .muted { font-size: 13px; }
.tl-track { position: relative; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; padding-top: 22px; }
.tl-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.tl-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.tl-dot { position: absolute; top: 10px; left: 10px; z-index: 1; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px rgba(11, 11, 11, .7); }
.tl-visual { aspect-ratio: 16 / 10; background: #1c1a16; display: block; overflow: hidden; }
.tl-visual img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(.92); transition: transform .3s; }
.tl-card:hover .tl-visual img { transform: scale(1.03); }
.tl-visual.typo {
  display: grid; place-items: center;
  background:
    repeating-linear-gradient(180deg, rgba(201,169,106,.10) 0 1px, transparent 1px 14px) center / 100% 58px no-repeat,
    linear-gradient(135deg, #1d1a14, #0f0e0c);
}
.tl-type { font-family: var(--serif); color: var(--gold); display: flex; align-items: baseline; gap: 4px; }
.tl-type .m { font-size: 54px; font-weight: 700; line-height: 1; }
.tl-type .slash { font-size: 34px; opacity: .6; }
.tl-type .dd { font-size: 54px; font-weight: 700; line-height: 1; }
.tl-body { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px 14px; }
.tl-date { color: var(--gold); font-size: 13px; font-variant-numeric: tabular-nums; }
.tl-title { font-family: var(--serif); font-weight: 700; font-size: 17px; line-height: 1.35; }
.tl-sum { color: var(--text-2); font-size: 13px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tl-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* ---------- 外部連結 ---------- */
.linkcard { display: inline-flex; gap: 12px; align-items: center; padding: 8px 14px 8px 8px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel); }
.linkcard:hover { border-color: var(--gold); }
.linkcard .qr { background: #fff; padding: 4px; border-radius: 3px; }
.lc-text { display: flex; flex-direction: column; line-height: 1.35; }
.lc-kind { color: var(--gold); font-size: 12px; }
.lc-label { font-size: 14.5px; }
.lc-hint { color: var(--muted); font-size: 11.5px; }

/* ---------- 資料頁 v2：目錄｜資訊｜PDF ---------- */
.docpage { grid-template-columns: var(--side) 300px minmax(0, 1fr); }
.docinfo {
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px 20px 24px; border-right: 1px solid var(--line);
  overflow-y: auto; overscroll-behavior: contain; background: var(--bg);
}
.doc-h1 { margin: 2px 0 0; font-family: var(--serif); font-size: 22px; line-height: 1.35; letter-spacing: .02em; }
.docinfo .docsummary { margin: 0; font-size: 14px; line-height: 1.7; }
.docinfo .doclinks { flex-direction: column; margin-top: 4px; gap: 8px; }
.docinfo .linkcard { width: 100%; }
.docnav { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.docnav a { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-radius: 4px; border: 1px solid transparent; }
.docnav a:hover { border-color: var(--line-2); background: var(--bg-2); }
.docnav .next { text-align: right; }
.dn-k { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--gold); }
.docnav .next .dn-k { justify-content: flex-end; }
.dn-k svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dn-t { font-size: 13.5px; color: var(--text-2); }
.docnav a:hover .dn-t { color: var(--text); }
.pageinput input { width: 52px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 4px; overflow: hidden; }
.segbtn { min-height: 38px; padding: 0 12px; background: var(--panel); border: 0; cursor: pointer; font-size: 13.5px; color: var(--text-2); }
.segbtn + .segbtn { border-left: 1px solid var(--line-2); }
.segbtn.on { background: var(--gold); color: #17140e; font-weight: 600; }
.pdf-pages { gap: 16px; }

/* 目錄改成抽屜（iPad 橫向、小筆電） */
@media (max-width: 1240px) {
  .docpage { grid-template-columns: 280px minmax(0, 1fr); }
  .docpage .sidebar {
    position: fixed; z-index: 60; top: var(--top); bottom: 0; left: 0; width: min(320px, 86vw);
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: 8px 0 30px rgba(0, 0, 0, .5);
  }
  .docpage.toc-open .sidebar { transform: none; }
  .docpage.toc-open .scrim { display: block; position: fixed; inset: var(--top) 0 0 0; z-index: 55; background: rgba(0, 0, 0, .5); }
  .toc-toggle { display: inline-flex; }
}
/* iPad 直向：資訊縮成上方一條 */
@media (max-width: 900px) {
  .docpage { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .docinfo { border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 16px; gap: 6px; max-height: 34vh; }
  .doc-h1 { font-size: 18px; }
  .docinfo .docsummary { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; }
  .docinfo .doclinks { flex-direction: row; overflow-x: auto; flex-wrap: nowrap; }
  .docinfo .linkcard { width: auto; flex: 0 0 auto; }
  .docnav { flex-direction: row; justify-content: space-between; padding-top: 6px; margin-top: 0; }
  .docnav a { padding: 4px 6px; max-width: 48%; }
  .dn-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .seg .segbtn { padding: 0 9px; }
}

/* 首頁時間軸：加上合照 */
.strip-line a { width: 176px; padding-right: 14px; }
.strip-line .si {
  display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover;
  border-radius: 4px; border: 1px solid var(--line); margin-bottom: 6px;
  transition: border-color .15s, transform .15s;
}
.strip-line a:hover .si { border-color: var(--gold); transform: translateY(-2px); }

/* 清單列：合照預覽 */
.row { grid-template-columns: 92px 128px minmax(0, 1fr) auto; align-items: center; }
.row-thumb { width: 128px; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); display: block; }
.row-thumb.none { border-style: dashed; border-color: var(--line); background: transparent; }
.row:hover .row-thumb { border-color: var(--gold); }
@media (max-width: 1000px) {
  .row { grid-template-columns: 70px 112px minmax(0, 1fr); }
  .row-thumb { width: 112px; }
  .row-meta { grid-column: 3; }
}
@media (max-width: 560px) {
  .row { grid-template-columns: 96px minmax(0, 1fr); }
  .row-date { grid-column: 1 / -1; }
  .row-thumb { width: 96px; }
  .row-meta { grid-column: 2; }
}
.row-thumb.cover { object-fit: contain; background: #1c1b19; padding: 3px; }
/* 第一頁縮圖放大，讓字看得清楚 */
.row-thumb.cover { aspect-ratio: auto; height: 150px; padding: 4px; }
@media (max-width: 1000px) { .row-thumb.cover { height: 132px; } }
@media (max-width: 560px) { .row-thumb.cover { height: 118px; } }
/* 第一頁縮圖：依頁面比例放大填滿，不留灰底 */
.row-thumb.cover {
  width: auto; height: auto; max-width: 128px; max-height: 182px;
  aspect-ratio: auto; object-fit: fill; padding: 0; background: none;
  justify-self: center;
}
@media (max-width: 1000px) { .row-thumb.cover { max-width: 112px; max-height: 160px; height: auto; } }
@media (max-width: 560px) { .row-thumb.cover { max-width: 96px; max-height: 136px; height: auto; } }
/* 第一頁縮圖：取頁面中段 16:10，跟合照同尺寸（2026-12-02 依社員範例） */
.row-thumb.cover {
  width: 128px; height: auto; max-width: none; max-height: none;
  aspect-ratio: 16 / 10; object-fit: cover; padding: 0; background: none; justify-self: stretch;
}
@media (max-width: 1000px) { .row-thumb.cover { width: 112px; max-width: none; max-height: none; } }
@media (max-width: 560px) { .row-thumb.cover { width: 96px; max-width: none; max-height: none; } }

/* 雲端備用按鈕 */
.drivebtn {
  display: flex; gap: 10px; align-items: center; padding: 9px 12px;
  border: 1px solid rgba(201, 169, 106, .45); border-radius: var(--radius); background: var(--gold-dim);
}
.drivebtn:hover { border-color: var(--gold); background: rgba(201, 169, 106, .22); }
.drivebtn svg { width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linejoin: round; }
.drivebtn span { display: flex; flex-direction: column; line-height: 1.35; }
.drivebtn b { font-weight: 600; font-size: 14px; color: var(--text); }
.drivebtn small { font-size: 11.5px; color: var(--muted); }
@media (max-width: 900px) { .drivebtn { padding: 6px 10px; } .drivebtn small { display: none; } }
.drivebtn.physical { cursor: default; background: transparent; border-style: dashed; }
.drivebtn.physical:hover { background: transparent; border-color: rgba(201, 169, 106, .45); }
