/* withbookie.com 共用設計（2026-09-30 改版）
   方向：暖白紙色、墨色正文、赭色連結，保留足夠閱讀空間。
   用法：頁面 <link rel="stylesheet" href="/site.css">，導覽列與頁尾用下方 .gnav／.gfoot 標記，互動由 /site.js 處理。 */

:root {
  --bg: #faf8f3;
  --bg-alt: #f0ece3;
  --card: #ffffff;
  --ink: #282822;
  --muted: #626158;
  --faint: #6d695e;
  --line: #dcd5c8;
  --accent: #80522f;
  --accent-hover: #633c20;
  --accent-soft: #eee4d6;
  --ok: #1b7f3b;
  --err: #c0362c;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 2px 12px rgba(0, 0, 0, .06);
  --shadow-hover: 0 8px 28px rgba(0, 0, 0, .10);
  --max: 1080px;
  --gutter: 22px;
  --nav-h: 52px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang TC", "Noto Sans TC", "Helvetica Neue", Arial, sans-serif;
  --display: "Songti TC", "Noto Serif TC", "PMingLiU", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input { font: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 200; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; }
.skip:focus { top: 10px; }

/* ── 版面 ── */
.wrap { max-width: var(--max); margin: 0 auto; padding-inline: var(--gutter); }
.wrap-narrow { max-width: 720px; margin: 0 auto; padding-inline: var(--gutter); }
.section { padding-block: 88px; }
.section-tight { padding-block: 56px; }
.section-alt { background: var(--bg-alt); }
@media (max-width: 734px) {
  :root { --gutter: 16px; }
  body { font-size: 16px; }
  .section { padding-block: 60px; }
  .section-tight { padding-block: 40px; }
}

/* ── 字級 ── */
.eyebrow { font-size: 14px; font-weight: 600; color: var(--accent); letter-spacing: .02em; margin: 0 0 10px; }
.h-hero { font-family: var(--display); font-weight: 700; font-size: clamp(40px, 7.2vw, 80px); line-height: 1.08; letter-spacing: -.02em; margin: 0; }
.h-section { font-family: var(--display); font-weight: 700; font-size: clamp(30px, 4.6vw, 48px); line-height: 1.12; letter-spacing: -.015em; margin: 0 0 12px; }
.h-card { font-family: var(--display); font-weight: 700; font-size: 22px; line-height: 1.3; margin: 0 0 8px; }
.lead { font-size: clamp(19px, 2.2vw, 24px); line-height: 1.45; color: var(--muted); margin: 16px 0 0; }
.sub { font-size: 17px; color: var(--muted); margin: 0; }
.center { text-align: center; }
.center .lead, .center .sub { margin-inline: auto; max-width: 640px; }

/* ── 按鈕 ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 22px; border-radius: 980px; border: 0; font-size: 17px; font-weight: 500; cursor: pointer; text-decoration: none !important; transition: background .2s, color .2s, transform .2s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.btn-secondary:hover { background: var(--accent-soft); }
.btn-small { min-height: 32px; padding: 5px 14px; font-size: 14px; }
.btn[disabled] { opacity: .55; cursor: wait; }
.btn-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 30px; }
.center .btn-row { justify-content: center; }
.more { font-size: 17px; font-weight: 500; }
.more::after { content: " ›"; }

/* ── 全站導覽列 ── */
.gnav { position: sticky; top: 0; z-index: 100; height: var(--nav-h); background: rgba(255, 255, 255, .82); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid rgba(0, 0, 0, .08); }
.gnav-inner { max-width: var(--max); margin: 0 auto; padding-inline: var(--gutter); height: 100%; display: flex; align-items: center; gap: 20px; }
.gnav-brand { display: flex; align-items: baseline; gap: 8px; color: var(--ink); text-decoration: none !important; margin-right: auto; }
.gnav-brand b { font-family: var(--display); font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.gnav-brand span { font-size: 12px; color: var(--muted); }
.gnav-links { display: flex; align-items: center; gap: 26px; margin: 0; padding: 0; list-style: none; }
.gnav-links a { color: var(--ink); font-size: 15px; opacity: .85; text-decoration: none; }
.gnav-links a:hover, .gnav-links a[aria-current="page"] { opacity: 1; color: var(--accent); }
.gnav-cta { flex: none; }
.gnav-toggle { display: none; width: 44px; height: 44px; border: 0; background: transparent; border-radius: 10px; cursor: pointer; color: var(--ink); padding: 0; }
.gnav-toggle svg { width: 22px; height: 22px; margin: auto; }
@media (max-width: 734px) {
  .gnav-links { display: none; }
  .gnav-toggle { display: flex; }
  .gnav-inner { gap: 8px; }
  .gnav-brand span { display: none; }
  .gnav.open { height: auto; background: rgba(255, 255, 255, .97); }
  .gnav.open .gnav-inner { flex-wrap: wrap; height: auto; padding-block: 6px 18px; }
  .gnav.open .gnav-brand { height: 40px; align-items: center; }
  .gnav.open .gnav-links { display: flex; order: 5; flex-direction: column; align-items: stretch; gap: 0; width: 100%; margin-top: 6px; }
  .gnav.open .gnav-links a { display: block; font-size: 24px; font-weight: 600; padding: 12px 4px; border-bottom: 1px solid var(--line); opacity: 1; }
}

/* ── 卡片 ── */
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 734px) { .grid-3, .grid-2, .grid-4 { grid-template-columns: 1fr; } }
.card { background: var(--card); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: box-shadow .25s, transform .25s; }
.section-alt .card { box-shadow: none; }
a.card { color: inherit; text-decoration: none; }
a.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); text-decoration: none; }
.card p { margin: 0 0 12px; color: var(--muted); }
.card .more { margin-top: auto; color: var(--accent); }
.step-num { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; margin-bottom: 16px; font-size: 16px; }

/* 手機橫向滑動卡片列 */
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 1fr); gap: 20px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px var(--gutter) 22px; margin-inline: calc(var(--gutter) * -1); scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }
@media (max-width: 734px) { .rail { grid-auto-columns: 82%; } }
.rail-hint { font-size: 14px; color: var(--faint); margin: 0 0 6px; display: none; }
@media (max-width: 734px) { .rail-hint { display: block; } }

/* ── 訂閱區塊 ── */
.signup-band { background: linear-gradient(180deg, #f5f7ff 0%, #eef2ff 100%); }
.signup-box { max-width: 760px; margin: 0 auto; text-align: center; }
.signup-box .h-section { margin-bottom: 10px; }
.signup-gift { display: flex; align-items: center; gap: 22px; justify-content: center; margin: 26px auto 0; text-align: left; max-width: 560px; }
.signup-gift img { width: 84px; border-radius: 6px; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); flex: none; }
.signup-gift p { margin: 0; color: var(--muted); font-size: 15px; }
.signup-gift strong { color: var(--ink); display: block; font-size: 17px; }
.signup-form { display: flex; gap: 10px; max-width: 520px; margin: 28px auto 0; }
.signup-form input { flex: 1; min-width: 0; height: 52px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 16px; font-size: 17px; background: #fff; color: var(--ink); }
.signup-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.signup-form .btn { height: 52px; border-radius: var(--radius-sm); padding-inline: 24px; flex: none; }
.signup-msg { min-height: 1.5em; margin: 14px 0 0; font-size: 15px; }
.signup-msg.ok { color: var(--ok); }
.signup-msg.err { color: var(--err); }
.signup-fine { font-size: 13px; color: var(--faint); margin: 8px 0 0; }
.signup-done { margin-top: 18px; }
@media (max-width: 560px) {
  .signup-form { flex-direction: column; }
  .signup-form input { flex: none; width: 100%; }
  .signup-form .btn { width: 100%; }
  .signup-gift { gap: 16px; }
  .signup-gift img { width: 64px; }
}

/* ── 頁尾 ── */
.gfoot { background: var(--bg-alt); color: var(--muted); font-size: 13px; padding: 40px 0 34px; border-top: 1px solid rgba(0, 0, 0, .06); }
.gfoot-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.gfoot h2 { font-size: 13px; font-weight: 600; color: var(--ink); margin: 0 0 10px; }
.gfoot ul { list-style: none; margin: 0; padding: 0; }
.gfoot li { margin: 0 0 8px; }
.gfoot a { color: var(--muted); }
.gfoot a:hover { color: var(--ink); }
.gfoot-bottom { border-top: 1px solid var(--line); margin-top: 26px; padding-top: 18px; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
@media (max-width: 734px) { .gfoot-cols { grid-template-columns: 1fr 1fr; } }

/* 桌面版：精選卡片改成多欄網格（不用橫向滑） */
@media (min-width: 735px) {
  .rail.rail-grid { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); overflow: visible; margin-inline: 0; padding: 4px 0 0; }
}
/* 橫向列的左右按鈕（桌面才顯示） */
.rail-nav { display: flex; justify-content: flex-end; gap: 10px; margin: 0 0 12px; }
.rail-nav button { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .07); color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer; }
.rail-nav button:hover { background: rgba(0, 0, 0, .12); }
.rail-nav button:disabled { opacity: .35; cursor: default; }
@media (max-width: 734px) { .rail-nav { display: none; } }
.hero .btn-row, .center .btn-row { justify-content: center; }

/* ── 內頁共用（2026-09-30 內頁改版追加；以上規則不動） ── */
.page-head { padding: 80px 0 44px; }
.page-head .lead { max-width: 680px; }
.page-head.center .lead { margin-inline: auto; }
@media (max-width: 734px) { .page-head { padding: 52px 0 28px; } }
.h-page { font-family: var(--display); font-weight: 700; font-size: clamp(34px, 5.6vw, 60px); line-height: 1.12; letter-spacing: -.015em; margin: 0; }
.h-sub { font-family: var(--display); font-weight: 700; font-size: clamp(24px, 3.2vw, 32px); line-height: 1.2; letter-spacing: -.01em; margin: 0 0 14px; }
.meta-line { font-size: 14px; font-weight: 600; color: var(--faint); letter-spacing: .02em; margin: 0 0 12px; }

/* 長文排版：電子報、讀本、書介 */
.prose { font-size: 18px; line-height: 1.85; color: var(--ink); overflow-wrap: anywhere; }
.prose p { margin: 0 0 1.2em; }
.prose h2 { font-family: var(--display); font-weight: 700; font-size: clamp(28px, 4vw, 40px); line-height: 1.2; letter-spacing: -.01em; margin: 2.4em 0 .6em; scroll-margin-top: calc(var(--nav-h) + 16px); }
.prose h3 { font-family: var(--display); font-weight: 700; font-size: clamp(22px, 2.8vw, 28px); line-height: 1.3; margin: 2em 0 .6em; scroll-margin-top: calc(var(--nav-h) + 16px); }
.prose blockquote { margin: 1.6em 0; padding: 18px 22px; background: var(--bg-alt); border-radius: var(--radius-sm); color: var(--muted); }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.2em; }
.prose li { margin-bottom: .5em; }
.prose figure { margin: 2em 0; }
.prose figure img { border-radius: var(--radius-sm); margin-inline: auto; }
.prose figcaption { font-size: 14px; color: var(--faint); margin-top: 10px; text-align: center; }
.prose a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--accent); }
@media (max-width: 734px) { .prose { font-size: 17px; } }

/* 清單列：文章、集數、章節 */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.rows > li { border-bottom: 1px solid var(--line); }
.row-link { display: flex; gap: 18px; align-items: baseline; padding: 20px 4px; min-height: 44px; color: var(--ink); text-decoration: none !important; }
.row-link:hover .row-title { color: var(--accent); }
.row-num { flex: none; width: 44px; font-family: var(--display); font-weight: 700; font-size: 22px; color: var(--accent); }
.row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row-title { font-size: 18px; font-weight: 600; line-height: 1.45; }
.row-desc { font-size: 15px; line-height: 1.65; color: var(--muted); }
.row-arrow { flex: none; color: var(--faint); }
.tag { display: inline-block; font-size: 12px; font-weight: 600; line-height: 1.6; color: var(--accent); background: var(--accent-soft); border-radius: 980px; padding: 1px 10px; margin-left: 8px; vertical-align: middle; white-space: nowrap; }

/* 出版通知表單（notify-form.js 處理，外觀跟訂閱表單一致） */
.notify-form { display: flex; gap: 10px; max-width: 520px; margin: 22px auto 0; }
.notify-form input { flex: 1; min-width: 0; height: 52px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 16px; font-size: 17px; background: #fff; color: var(--ink); }
.notify-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.notify-form .btn { height: 52px; border-radius: var(--radius-sm); padding-inline: 24px; flex: none; }
.notify-msg { min-height: 1.5em; margin: 12px 0 0; font-size: 15px; color: var(--muted); }
@media (max-width: 560px) {
  .notify-form { flex-direction: column; }
  .notify-form input { flex: none; width: 100%; }
  .notify-form .btn { width: 100%; }
}

/* 手機觸控目標 44px（2026-09-30 驗收補） */
@media (max-width: 734px) {
  .gnav-cta { min-height: 36px; padding-inline: 16px; position: relative; }
  .gnav-cta::after { content: ""; position: absolute; inset: -4px 0; }
  .gfoot li a { display: inline-block; padding-block: 6px; }
}
/* 橫向列捲動時第一張卡保留左邊留白；外連「↗」不再加「›」 */
.rail { scroll-padding-inline: var(--gutter); }
.more.ext::after { content: none; }

/* ── 中文斷行（2026-09-30）──
   標題、引言、按鈕、卡片短句：只在標點或空格處換行，不在詞中間切開；行長自動平均，避免尾行只剩一兩個字。
   句子本身比一行還長、又沒有標點時，overflow-wrap:anywhere 才讓它在任意處斷，避免溢出。
   長篇內文維持一般斷行，但用 pretty 避免最後一行只剩一個字。 */
h1, h2, h3, h4, .h-hero, .h-section, .h-card, .lead, .sub, .eyebrow, .btn, .more,
.story-meta, .story-q, .step-num + .h-card, .signup-fine, .signup-msg,
.cat-title, .cat-q, .results b, .results small, .search-status, .chip, .gnav, .gfoot li, .gfoot-bottom span,
.rail-hint, figcaption, label, [data-balance] {
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
p, li, blockquote, dd { text-wrap: pretty; }
/* 長段落（卡片摘錄、內文）用一般斷行，只避免尾行孤字 */
.card p:not(.story-meta):not(.story-q), .signup-gift p, .prose p { word-break: normal; overflow-wrap: break-word; text-wrap: pretty; }

/* site.js 按詞語加了斷點（<wbr>）的短句：只在詞與詞之間換行；.nobr＝段落最後幾個字綁在一起 */
.bx { word-break: keep-all !important; overflow-wrap: anywhere; }
.nobr { white-space: nowrap; }
/* 置中的引言在桌面版盡量一行放完（Apple 式副標），手機再按標點與詞語換行 */
.center .lead, .hero .lead { max-width: 900px; }

/* 閱讀網站的共用細節 */
.gnav { background:rgba(250,248,243,.96); }
.h-section { line-height:1.35; }
.lead { line-height:1.75; }
.card { border:1px solid var(--line); box-shadow:none; }
.signup-band { background:var(--bg-alt); border-block:1px solid var(--line); }
.signup-gift img { height:auto; }
.signup-gift a { display:block; margin-top:5px; text-decoration:underline; text-underline-offset:3px; }
.btn { border-radius:7px; }
.gfoot { background:var(--bg-alt); }

.letters-signup { padding-block:32px; }
.letters-signup .signup-box { max-width:720px; }
.letters-signup .h-section { font-size:28px; }
.letters-signup .lead { font-size:17px; margin-top:8px; }
.letters-signup .signup-form { margin-top:18px; }
.letters-signup .signup-fine { margin-top:10px; }
@media(max-width:734px) {
  .letter-head { padding-top:32px !important; padding-bottom:24px !important; }
  .letters-signup { padding-block:24px; }
}
