:root {
  --paper: #f5f2ea;
  --sheet: #fbfaf6;
  --ink: #23241f;
  --muted: #5a5850;
  --line: #d8d2c4;
  --rule: #e0dacb;
  --indigo: #2c4262;
  --indigo-deep: #1d2c44;
  --indigo-pale: #e3e8ef;
  --ochre: #a8783a;
  --ochre-text: #84581f;
  --cream-on-indigo: #ece5d3;
  --serif: "Noto Serif TC", "Source Han Serif TC", "Songti TC", "PMingLiU", serif;
  /* 標題與書名：仙人掌明體只抓用到的字（shiye.html 的 text= 參數），只有 400 一種粗細，不可設粗體 */
  --display: "Cactus Classical Serif", var(--serif);
  --sans: "PingFang TC", "Noto Sans TC", "Source Han Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  --gutter: clamp(20px, 5vw, 96px);
  --max: 1600px;
  --section: clamp(96px, 10vw, 184px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --radius: 2px;
  --header-h: 76px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.8;
  letter-spacing: .04em;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
em { font-style: normal; }
a { color: inherit; }
button, input { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; font-family: var(--display); font-weight: 400; }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 3px; }

.wrap { width: min(var(--max), 100% - var(--gutter) * 2); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 100; padding: 10px 16px; background: var(--ink); color: var(--paper); text-decoration: none; }
.skip-link:focus { top: 12px; }

/* ===== 按鈕：箭頭接力 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 14px;
  min-height: 52px; padding: 0 26px;
  border: 1px solid var(--ink); border-radius: var(--radius);
  background: var(--ink); color: var(--paper);
  font-size: 15px; letter-spacing: .14em; text-decoration: none;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
.btn:hover { background: var(--indigo-deep); border-color: var(--indigo-deep); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.arrow { display: inline-grid; width: 1em; overflow: hidden; line-height: 1; }
.arrow i { grid-area: 1 / 1; font-style: normal; transition: transform .32s var(--ease); }
.arrow i + i { transform: translateX(-130%); }
.btn:hover .arrow i:first-child { transform: translateX(130%); }
.btn:hover .arrow i + i { transform: none; }

/* ===== 連結底線滑入 ===== */
.text-link, .nav a {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) no-repeat right bottom / 0 1px;
  transition: background-size .3s var(--ease);
}
.text-link:hover, .nav a:hover { background-position: left bottom; background-size: 100% 1px; }
.text-link { display: inline-flex; align-items: center; min-height: 44px; font-size: 15px; color: var(--indigo); }

/* ===== 頁首：往下捲收起、往上捲出現 ===== */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 50;
  background: rgba(245, 242, 234, .9);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: transform .35s var(--ease), background-color .3s, border-color .3s;
}
.site-header.is-scrolled { background: rgba(245, 242, 234, .96); border-color: var(--line); }
.site-header.is-hidden { transform: translateY(-100%); }
.header-inner { display: flex; align-items: center; gap: clamp(20px, 3vw, 48px); min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 14px; min-height: 44px; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 30px; height: 42px;
  border-left: 5px solid var(--indigo-deep);
  background: var(--indigo); color: var(--cream-on-indigo);
  font-family: var(--serif); font-size: 12px; line-height: 1.15; letter-spacing: .1em;
  writing-mode: vertical-rl;
}
.brand-name { font-family: var(--display); font-size: 20px; letter-spacing: .24em; }
.nav { display: flex; gap: clamp(20px, 2.4vw, 40px); margin-left: auto; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; font-size: 15px; letter-spacing: .14em; }
.header-cta {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px;
  border: 1px solid var(--ink); border-radius: var(--radius);
  font-size: 14px; letter-spacing: .14em; text-decoration: none;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
.header-cta:hover { background: var(--ink); color: var(--paper); }
.toc-toggle {
  display: none; align-items: center; justify-content: center;
  min-width: 56px; min-height: 44px; padding: 0 14px; margin-left: auto;
  border: 1px solid var(--ink); border-radius: var(--radius); background: var(--paper);
  font-family: var(--serif); font-size: 15px; letter-spacing: .24em;
}

/* ===== 首屏 ===== */
.hero {
  position: relative; display: flex; align-items: flex-end;
  min-height: 100vh; min-height: 100dvh; overflow: hidden;
}
.hero-media { position: absolute; inset: 0; }
.hero-media img {
  width: 100%; height: 100%; object-fit: cover; object-position: 42% 50%;
  animation: hero-drift 26s ease-in-out infinite alternate;
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(245, 242, 234, .86) 0%, rgba(245, 242, 234, .62) 30%, rgba(245, 242, 234, 0) 58%);
}
.hero-inner {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 40px;
  padding: calc(var(--header-h) + 64px) 0 clamp(48px, 8vh, 104px);
}
.hero-copy { display: flex; align-items: flex-start; gap: clamp(28px, 3.4vw, 64px); }
.hero-kicker { font-size: 14px; letter-spacing: .24em; color: var(--muted); margin-bottom: 20px; }
.hero-title {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(54px, 7.2vw, 124px); line-height: 1.15; letter-spacing: .14em;
  margin-bottom: 28px; white-space: nowrap;
  animation: spread-in 1.4s var(--ease) .15s both;
}
.hero-lead { max-width: 26em; font-size: clamp(16px, 1.15vw, 18px); line-height: 1.8; margin-bottom: 36px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.hero-catch {
  writing-mode: vertical-rl;
  font-family: var(--serif); font-size: clamp(17px, 1.35vw, 21px); line-height: 1.8; letter-spacing: .36em;
  padding-top: 6px; border-right: 1px solid var(--ink); padding-right: 14px;
  animation: catch-in 1.2s var(--ease) .9s both;
}
.today {
  justify-self: end; width: min(320px, 100%);
  padding: 22px 26px 24px;
  background: rgba(251, 250, 246, .95);
  border-top: 3px solid var(--indigo);
  animation: catch-in 1s var(--ease) 1.2s both;
}
.today-label { font-size: 13px; letter-spacing: .24em; color: var(--muted); }
.today-date { display: flex; align-items: baseline; gap: 10px; margin: 2px 0 6px; font-family: var(--serif); font-size: 46px; line-height: 1.2; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.today-date small { font-family: var(--sans); font-size: 14px; letter-spacing: .14em; color: var(--muted); }
.today-book { font-family: var(--display); font-size: 19px; line-height: 1.5; letter-spacing: .08em; }
.today-note { font-size: 14px; line-height: 1.75; color: var(--muted); margin-top: 4px; }
.today-spot { margin-top: 12px; padding-top: 10px; border-top: 1px dotted var(--line); font-size: 13px; letter-spacing: .08em; color: var(--ochre-text); }

@keyframes hero-drift { from { transform: scale(1.02); } to { transform: scale(1.08) translateX(-1%); } }
@keyframes spread-in {
  from { letter-spacing: -.42em; filter: blur(10px); opacity: 0; }
  to { letter-spacing: .14em; filter: blur(0); opacity: 1; }
}
@keyframes catch-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ===== 段落標題：模糊對焦 ===== */
.sec-head { display: grid; gap: 12px; margin-bottom: clamp(44px, 5vw, 80px); }
.sec-head--split { grid-template-columns: minmax(0, 1fr) minmax(0, 28em); align-items: end; gap: 24px clamp(32px, 6vw, 120px); }
.sec-no {
  display: inline-flex; align-items: center; gap: 14px;
  font-family: var(--serif); font-size: 15px; letter-spacing: .12em; color: var(--ochre-text); font-variant-numeric: tabular-nums;
}
.sec-no::after { content: ""; width: 40px; height: 1px; background: currentColor; }
h2 { font-family: var(--display); font-size: clamp(28px, 3vw, 46px); line-height: 1.4; letter-spacing: .1em; }
.sec-aside { font-size: 15px; line-height: 1.8; color: var(--muted); max-width: 28em; }
.sec-aside small { display: block; margin-top: 6px; font-size: 13px; letter-spacing: .08em; }
.focus-in.is-ready { filter: blur(12px); opacity: .12; transition: filter .8s var(--ease), opacity .8s var(--ease); }
.focus-in.is-ready.is-in { filter: blur(0); opacity: 1; }

.frame { position: relative; overflow: hidden; background: var(--rule); }
.frame img { width: 100%; height: 100%; object-fit: cover; }
.frame img[data-parallax] { height: 116%; margin-top: -8%; will-change: transform; }
.frame figcaption {
  position: absolute; left: 0; bottom: 0;
  padding: 10px 16px; background: var(--sheet);
  font-size: 13px; letter-spacing: .08em; color: var(--muted);
}

/* ===== 一：關於（直排與罫線） ===== */
.about { padding: var(--section) 0; }
.about-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(48px, 9vw, 180px); align-items: start;
}
.about-vertical {
  grid-column: 2; grid-row: 1;
  writing-mode: vertical-rl;
  font-family: var(--serif); font-size: clamp(18px, 1.45vw, 22px); line-height: 2.2; letter-spacing: .26em;
  height: 23em; margin-right: clamp(0px, 4vw, 80px);
}
.about-vertical .dots {
  -webkit-text-emphasis: filled dot transparent;
  text-emphasis: filled dot transparent;
}
.about-vertical .dots i { font-style: normal; transition: -webkit-text-emphasis-color .4s var(--ease), text-emphasis-color .4s var(--ease); }
.about-vertical .dots i.on { -webkit-text-emphasis-color: var(--ochre); text-emphasis-color: var(--ochre); }
.about-body { grid-column: 1; grid-row: 1; max-width: 40em; padding-top: clamp(0px, 4vw, 80px); }
.ruled {
  --lh: 2.15em;
  font-size: 17px; line-height: var(--lh);
  background-image: linear-gradient(to bottom, transparent calc(var(--lh) - 1px), var(--rule) calc(var(--lh) - 1px));
  background-size: 100% var(--lh); background-repeat: repeat-y;
  margin-bottom: var(--lh);
}
.ruled.is-ready { background-size: 0% var(--lh); transition: background-size 1.4s var(--ease); }
.ruled.is-ready.is-in { background-size: 100% var(--lh); }
.note-ref {
  display: inline-block; margin-inline: 2px; font-size: 12px; line-height: 1; vertical-align: super;
  color: var(--ochre-text); text-decoration: none; letter-spacing: 0;
}
.note-ref:hover { text-decoration: underline; }
.side-notes { display: grid; gap: 10px; margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--line); }
.side-notes li { display: grid; grid-template-columns: 2.6em 1fr; font-size: 13px; line-height: 1.8; color: var(--muted); transition: color .25s; }
.side-notes li span { color: var(--ochre-text); }
.side-notes li:target, .side-notes li.is-hot { color: var(--ink); }

/* ===== 二：本月選書（疊書散開、封面掀開） ===== */
.picks { padding: var(--section) 0; background: var(--sheet); }
.picks-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(56px, 6vw, 112px) clamp(28px, 4vw, 80px);
}
.pick:nth-child(3n + 2) { margin-top: clamp(40px, 7vw, 136px); }
.pick-stage {
  position: relative; display: grid; place-items: center;
  aspect-ratio: 4 / 4.4; background: var(--paper); margin-bottom: 24px;
  perspective: 1400px;
}
.pick-tab {
  position: absolute; top: 0; right: 0; z-index: 2;
  writing-mode: vertical-rl;
  padding: 14px 8px; background: var(--indigo); color: var(--cream-on-indigo);
  font-size: 13px; letter-spacing: .22em; line-height: 1.4;
}
.book {
  position: relative; width: 56%; aspect-ratio: 2 / 3;
  transition: transform .9s var(--ease);
}
.book-page { position: absolute; inset: 2% 0 2% 3%; background: #fffdf6; box-shadow: 0 18px 30px -18px rgba(35, 36, 31, .45); }
.book-page::before { content: ""; position: absolute; inset: 16% 18%; background: repeating-linear-gradient(to bottom, #d9d3c4 0 1px, transparent 1px 11px); opacity: .7; }
.book-cover {
  position: absolute; inset: 0; overflow: hidden;
  background: var(--c); color: var(--t);
  transform-origin: left center; transform-style: preserve-3d;
  box-shadow: inset 6px 0 0 rgba(0, 0, 0, .12), 0 24px 40px -22px rgba(35, 36, 31, .6);
  transition: transform .6s var(--ease), box-shadow .6s var(--ease);
}
.pick:hover .book-cover, .pick:focus-within .book-cover { transform: rotateY(-26deg); box-shadow: inset 6px 0 0 rgba(0, 0, 0, .12), 18px 26px 40px -20px rgba(35, 36, 31, .5); }
.cv-title {
  position: absolute; top: 12%; right: 13%;
  writing-mode: vertical-rl; font-family: var(--display); font-size: clamp(15px, 1.35vw, 22px); letter-spacing: .3em; line-height: 1.3;
}
.cv-author { position: absolute; left: 14%; top: 12%; writing-mode: vertical-rl; font-size: clamp(10px, .75vw, 12px); letter-spacing: .3em; opacity: .85; }
.obi {
  position: absolute; left: 0; right: 0; bottom: 8%;
  padding: 7% 10%; background: #f6f1e5; color: #2c2a24;
  font-size: clamp(10px, .78vw, 12px); line-height: 1.5; letter-spacing: .1em; text-align: center;
}
.cover-sun::before { content: ""; position: absolute; left: 22%; top: 46%; width: 34%; aspect-ratio: 1; border-radius: 50%; background: #e5b765; opacity: .9; }
.cover-lines::before { content: ""; position: absolute; left: 14%; right: 44%; top: 26%; height: 36%; background: repeating-linear-gradient(to bottom, currentColor 0 1px, transparent 1px 8px); opacity: .55; }
.cover-rail::before { content: ""; position: absolute; left: 0; right: 0; top: 58%; height: 2px; background: #c9b78f; box-shadow: 0 8px 0 #c9b78f; }
.cover-leaf::before { content: ""; position: absolute; left: 18%; top: 34%; width: 36%; height: 26%; border-radius: 0 100% 0 100%; background: #4f6a46; opacity: .85; }
.cover-grid::before { content: ""; position: absolute; left: 14%; top: 34%; width: 44%; height: 30%; background: linear-gradient(currentColor, currentColor) 0 0 / 100% 1px, linear-gradient(90deg, currentColor 1px, transparent 1px) 0 0 / 25% 100%, linear-gradient(currentColor 1px, transparent 1px) 0 0 / 100% 33.4%; opacity: .5; }
.cover-room::before { content: ""; position: absolute; left: 18%; top: 30%; width: 34%; height: 34%; border: 1px solid currentColor; box-shadow: inset 0 -12px 0 rgba(255, 255, 255, .35); opacity: .7; }
.pick-meta { padding-right: 8%; }
.pick-cat { font-size: 13px; letter-spacing: .24em; color: var(--ochre-text); }
.pick-meta h3 { font-family: var(--display); font-size: clamp(19px, 1.4vw, 22px); line-height: 1.45; letter-spacing: .08em; margin: 4px 0 6px; }
.pick-by { display: flex; gap: 14px; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.pick-by span { font-variant-numeric: tabular-nums; }
.pick-meta > p:last-child { font-size: 15px; line-height: 1.8; }
.picks-grid.is-piled .book { transform: translate(var(--dx, 0), var(--dy, 0)) rotate(var(--r, 0deg)); transition: none; }
.picks-grid.is-piled .pick-meta, .picks-grid.is-piled .pick-tab { opacity: 0; }
.pick-meta, .pick-tab { transition: opacity .6s var(--ease) .5s; }
.picks-grid.is-piled .pick-stage { background: transparent; }
.pick-stage { transition: background-color .6s var(--ease) .4s; }

/* ===== 三：第一句（直書逆走） ===== */
.firstlines {
  position: relative; display: grid; grid-template-columns: 1fr minmax(0, 30em) 1fr; align-items: center;
  height: min(92vh, 920px); min-height: 620px; overflow: hidden;
  background: var(--indigo-deep); color: var(--cream-on-indigo);
}
.fl-cols {
  display: flex; justify-content: space-evenly; height: 100%;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
}
.fl-col { writing-mode: vertical-rl; white-space: nowrap; height: 100%; overflow: hidden; font-family: var(--serif); line-height: 1.6; }
.fl-col span { display: block; }
.fl-col--lg { font-size: clamp(22px, 2vw, 32px); letter-spacing: .3em; opacity: .9; }
.fl-col--md { font-size: clamp(17px, 1.4vw, 22px); letter-spacing: .3em; opacity: .62; }
.fl-col--sm { font-size: 14px; letter-spacing: .4em; opacity: .42; }
.fl-up span { animation: flow-up 60s linear infinite; }
.fl-down span { animation: flow-down 48s linear infinite; }
.fl-col--sm span { animation-duration: 30s; }
.fl-col--lg span { animation-duration: 72s; }
@keyframes flow-up { from { transform: translateY(0); } to { transform: translateY(-50%); } }
@keyframes flow-down { from { transform: translateY(-50%); } to { transform: translateY(0); } }
.fl-center { position: relative; text-align: center; padding: 48px 24px; }
.fl-center .sec-no { color: #d6b98a; justify-content: center; }
.fl-center .sec-no::before { content: ""; width: 40px; height: 1px; background: currentColor; }
.fl-center h2 { margin: 14px 0 22px; }
.fl-center p { font-size: 16px; line-height: 1.8; max-width: 24em; margin-inline: auto; color: #d9d6cc; }

/* ===== 四：書架 ===== */
.shelf-section { padding: var(--section) 0; }
.shelf-tabs { display: flex; flex-wrap: wrap; gap: 6px 4px; margin-bottom: 28px; border-bottom: 1px solid var(--line); }
.shelf-tabs button {
  position: relative; min-height: 48px; padding: 0 18px;
  border: 0; background: none; color: var(--muted);
  font-size: 15px; letter-spacing: .12em;
}
.shelf-tabs button::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: -1px; height: 2px; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease); }
.shelf-tabs button[aria-selected="true"] { color: var(--ink); }
.shelf-tabs button[aria-selected="true"]::after { transform: scaleX(1); }
.shelf-tabs button:hover { color: var(--ink); }
.shelf-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .9fr); gap: clamp(28px, 4vw, 72px); align-items: stretch; }
.shelf {
  position: relative; display: flex; align-items: flex-end; gap: 0;
  min-height: 480px; padding: 56px clamp(20px, 3vw, 48px) 0;
  background: linear-gradient(to bottom, #e9e2d2, #e2d9c5);
  border-bottom: 20px solid #7e6344;
  box-shadow: inset 0 24px 40px -30px rgba(35, 36, 31, .35);
}
.shelf-books { --sw: 1.38; --sh: 1.1; display: flex; align-items: flex-end; gap: 4px; flex: none; min-width: 0; margin-right: 28px; }
.shelf-pop {
  align-self: flex-end; flex: 0 1 240px; min-width: 150px; margin: 0 0 0 auto; padding: 18px 20px 20px;
  background: #fffdf6; border-top: 6px solid var(--ochre);
  box-shadow: 0 14px 24px -18px rgba(35, 36, 31, .55);
  transform: rotate(-2deg); transform-origin: bottom left;
}
.shelf-pop.is-swap { animation: pop-in .5s var(--ease) backwards; }
@keyframes pop-in { from { opacity: 0; transform: rotate(-7deg) translateY(16px); } to { opacity: 1; transform: rotate(-2deg); } }
.shelf-pop b { display: block; font-weight: 400; font-size: 12px; letter-spacing: .24em; color: var(--ochre-text); margin-bottom: 6px; }
.shelf-pop p { font-family: var(--serif); font-size: 16px; line-height: 1.75; letter-spacing: .06em; }
.spine {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  width: calc(var(--w, 58px) * var(--sw, 1)); height: calc(var(--h, 320px) * var(--sh, 1)); padding: 22px 0 16px;
  border: 0; border-radius: 1px 1px 0 0;
  background: var(--c); color: var(--t);
  writing-mode: vertical-rl;
  font-family: var(--display); font-size: clamp(14px, 1.05vw, 16px); letter-spacing: .2em; line-height: 1.3;
  box-shadow: inset -3px 0 0 rgba(0, 0, 0, .1), inset 3px 0 0 rgba(255, 255, 255, .12);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.spine::before { content: ""; position: absolute; left: 18%; right: 18%; top: 10px; height: 4px; border-top: 1px solid currentColor; border-bottom: 1px solid currentColor; opacity: .45; }
.spine small { font-family: var(--sans); font-size: 11px; letter-spacing: .2em; opacity: .8; }
.spine:hover { transform: translateY(-10px); }
.spine[aria-pressed="true"] { transform: translateY(-30px); box-shadow: inset -3px 0 0 rgba(0, 0, 0, .1), 0 18px 24px -16px rgba(35, 36, 31, .6); }
.spine.is-shelving { animation: shelve-in .6s var(--ease) backwards; animation-delay: calc(var(--i) * 70ms); }
@keyframes shelve-in { from { opacity: 0; transform: translateX(80px) rotate(8deg); } to { opacity: 1; transform: none; } }
.shelf-detail {
  display: flex; flex-direction: column;
  padding: clamp(28px, 3vw, 48px); background: var(--sheet); border: 1px solid var(--line);
}
.shelf-detail.is-swap > * { animation: detail-in .5s var(--ease) backwards; }
.shelf-detail.is-swap > *:nth-child(2) { animation-delay: .05s; }
.shelf-detail.is-swap > *:nth-child(3) { animation-delay: .1s; }
.shelf-detail.is-swap > *:nth-child(4) { animation-delay: .15s; }
.shelf-detail.is-swap > *:nth-child(5) { animation-delay: .2s; }
@keyframes detail-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.detail-shelf { font-size: 13px; letter-spacing: .24em; color: var(--ochre-text); }
.shelf-detail h3 { font-family: var(--display); font-size: clamp(24px, 2.1vw, 32px); line-height: 1.4; letter-spacing: .08em; margin: 10px 0 4px; }
.detail-note { margin: 16px 0 24px; font-size: 16px; line-height: 1.8; }
.detail-foot { margin-top: auto; padding-top: 24px; font-size: 13px; color: var(--muted); }

.leader-list { display: grid; gap: 4px; }
.leader-list div { display: flex; align-items: baseline; gap: 12px; min-height: 36px; }
.leader-list dt { font-size: 14px; letter-spacing: .2em; color: var(--muted); flex: none; }
.leader { flex: 1; min-width: 24px; border-bottom: 1px dotted #a9a291; transform: translateY(-5px); }
.leader-list dd { font-size: 15px; text-align: right; font-variant-numeric: tabular-nums; }
.leader-list--large dd { font-size: 16px; }

/* ===== 五：活動 ===== */
.events { padding: var(--section) 0; background: var(--sheet); }
.events-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(32px, 5vw, 104px); align-items: stretch; }
.events-photo { min-height: 440px; }
.closed-days { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; margin: -24px 0 28px; font-family: var(--serif); font-size: 22px; letter-spacing: .04em; }
.closed-days small { font-family: var(--sans); font-size: 12px; color: var(--muted); }
.closed-label { font-family: var(--sans); font-size: 13px; letter-spacing: .24em; color: var(--ochre-text); padding: 2px 10px; border: 1px solid currentColor; }
.event-list { border-top: 1px solid var(--ink); }
.event {
  position: relative; display: grid; grid-template-columns: 6.4em minmax(0, 1fr) auto; gap: 8px clamp(16px, 2vw, 32px); align-items: center;
  padding: 22px 12px; border-bottom: 1px solid var(--line); isolation: isolate;
}
.event::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--indigo-pale); transform: scaleX(0); transform-origin: left; transition: transform .45s var(--ease); }
.event:hover::before, .event:focus-within::before { transform: scaleX(1); }
.event-date { display: grid; font-family: var(--serif); font-size: 28px; line-height: 1.2; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.event-date small { font-family: var(--sans); font-size: 13px; letter-spacing: .16em; color: var(--muted); }
.event-body h3 { font-family: var(--display); font-size: 19px; line-height: 1.45; letter-spacing: .06em; }
.event-body p { font-size: 14px; line-height: 1.75; }
.event-body .event-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.event-btn {
  display: grid; justify-items: center; min-width: 104px; min-height: 52px; padding: 6px 14px;
  border: 1px solid var(--ink); border-radius: var(--radius); background: var(--sheet);
  font-size: 14px; letter-spacing: .1em; line-height: 1.4;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
.event-btn small { font-size: 12px; color: var(--muted); letter-spacing: .06em; }
.event-btn:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.event-btn:hover:not(:disabled) small { color: inherit; }
.event-btn:disabled { cursor: default; border-color: var(--line); color: var(--muted); }
.event-btn.is-held { background: var(--indigo); border-color: var(--indigo); color: var(--paper); }
.event-btn.is-held small { color: var(--cream-on-indigo); }
.event-status { margin-top: 18px; font-size: 13px; color: var(--muted); }

/* ===== 六：選書單（打字機） ===== */
.booklist { padding: var(--section) 0; }
.booklist-grid { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: clamp(32px, 5vw, 104px); align-items: stretch; }
.booklist-side { display: flex; flex-direction: column; gap: 22px; }
.booklist-photo { flex: 1; min-height: 360px; }
.booklist-aside { font-size: 15px; line-height: 1.8; color: var(--muted); max-width: 30em; }
.booklist-form { display: grid; gap: 22px; margin-bottom: 32px; }
.booklist-form fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.booklist-form legend { width: 100%; margin-bottom: 10px; font-size: 15px; letter-spacing: .14em; font-weight: 500; }
.booklist-form label { position: relative; }
.booklist-form input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.booklist-form label span {
  display: inline-flex; align-items: center; min-height: 46px; padding: 0 18px;
  border: 1px solid #8f897c; border-radius: var(--radius); background: var(--sheet);
  font-size: 15px; letter-spacing: .1em;
  transition: border-color .2s var(--ease), background-color .2s var(--ease), color .2s var(--ease);
}
.booklist-form label:hover span { border-color: var(--ink); }
.booklist-form input:checked + span { background: var(--indigo); border-color: var(--indigo); color: var(--paper); }
.booklist-form input:focus-visible + span { outline: 2px solid var(--indigo); outline-offset: 3px; }
.booklist-form .btn { justify-self: start; margin-top: 4px; }
.slip {
  position: relative; padding: 28px clamp(22px, 3vw, 40px) 32px;
  background: #fffdf7; border: 1px solid var(--line);
  box-shadow: 0 24px 40px -32px rgba(35, 36, 31, .5);
}
.slip::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 8px; background: radial-gradient(circle at 6px -2px, var(--paper) 5px, transparent 5.5px) 0 0 / 14px 8px repeat-x; }
.slip-head { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 12px; margin-bottom: 6px; border-bottom: 2px solid var(--ink); font-family: var(--serif); font-size: 16px; letter-spacing: .16em; }
.slip.is-sample .slip-head span:last-child { color: var(--ochre-text); }
.slip-head span:last-child { font-family: var(--sans); font-size: 13px; color: var(--muted); letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.slip-lines { min-height: calc(2.2em * 5); }
.slip-line { display: grid; grid-template-columns: 6em minmax(0, 1fr); gap: 12px; min-height: 2.2em; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--rule); font-size: 15px; line-height: 1.7; }
.slip-line b { font-weight: 400; font-size: 13px; letter-spacing: .2em; color: var(--muted); }
.slip-line span.is-typing::after { content: ""; display: inline-block; width: 1px; height: 1.1em; margin-left: 2px; vertical-align: -2px; background: var(--ink); animation: caret .7s steps(1) infinite; }
.slip-line--title span { font-family: var(--display); font-size: 19px; letter-spacing: .06em; }
.slip-empty { padding: 22px 0; font-size: 15px; color: var(--muted); border-bottom: 1px solid var(--rule); }
@keyframes caret { 50% { opacity: 0; } }

/* ===== 七：來店 ===== */
.visit { padding: var(--section) 0 calc(var(--section) * .8); }
.visit-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: clamp(32px, 5vw, 104px); align-items: stretch; }
.visit-photos { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(12px, 1.4vw, 20px); min-height: 520px; }
.visit-photos .frame:last-child { margin-top: clamp(40px, 6vw, 96px); }
.visit-today { display: inline-flex; align-items: center; gap: 10px; margin: -28px 0 24px; padding: 6px 14px; background: var(--indigo-pale); font-size: 14px; letter-spacing: .1em; }
.visit-today::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--indigo); }
.visit-today.is-closed::before { background: var(--muted); }
.visit-way { margin: 28px 0 12px; font-size: 15px; line-height: 1.8; max-width: 32em; }

/* ===== 版權頁 ===== */
.colophon { padding: clamp(72px, 9vw, 136px) 0 40px; border-top: 1px solid var(--line); }
.colophon-box { max-width: 560px; margin: 0 auto; padding: 32px 0 28px; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.colophon-name { font-family: var(--display); font-size: 26px; letter-spacing: .3em; margin-bottom: 18px; }
.colophon-box dl { display: grid; gap: 6px; }
.colophon-box dl div { display: grid; grid-template-columns: 5em 1fr; gap: 12px; font-size: 14px; line-height: 1.8; }
.colophon-box dt { color: var(--muted); letter-spacing: .2em; }
.colophon-note { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.colophon-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; max-width: 560px; margin: 24px auto 0; font-size: 13px; color: var(--muted); }

/* ===== 手機目次：書從左側滑入，停穩後翻開封面 ===== */
.toc {
  position: fixed; inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none;
  margin: 0; padding: 0; border: 0; background: transparent; overflow: hidden;
  /* clip 不建立捲動容器：開啟時焦點落在還在畫面外的書上，hidden 會被瀏覽器偷偷橫捲，書看起來直接出現又抖回去 */
  overflow: clip;
}
.toc::backdrop { background: rgba(35, 36, 31, .5); }
.toc[open]::backdrop { animation: toc-fade .4s ease-out both; }
.toc.is-closing::backdrop { animation: toc-fade .3s ease-in .3s reverse both; }
@keyframes toc-fade { from { opacity: 0; } to { opacity: 1; } }
.toc-book { position: absolute; inset: 0; perspective: 1800px; box-shadow: 14px 0 40px rgba(35, 36, 31, .22); will-change: transform; }
/* 起步稍等一格、緩起緩停：開啟當下瀏覽器要先排版整個目次，起步太猛會掉格看起來像跳一下 */
.toc[open] .toc-book { animation: book-in .6s cubic-bezier(.35, 0, .15, 1) 60ms both; }
.toc.is-closing .toc-book { animation: book-out .36s cubic-bezier(.4, 0, .7, .3) .3s both; }
@keyframes book-in { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes book-out { from { transform: none; } to { transform: translateX(-100%); } }
.toc-page { position: absolute; inset: 0; display: flex; flex-direction: column; overflow-y: auto; padding: 20px var(--gutter) 28px; background: var(--paper); }
.toc-cover {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end;
  padding: 88px var(--gutter) 56px;
  background: var(--indigo); color: var(--cream-on-indigo);
  border-left: 10px solid var(--indigo-deep);
  transform-origin: left center; backface-visibility: hidden;
  transform: rotateY(-108deg); pointer-events: none;
}
.toc-cover-title { writing-mode: vertical-rl; font-family: var(--display); font-size: 40px; letter-spacing: .4em; }
.toc-cover-sub { font-family: var(--serif); font-size: 16px; letter-spacing: .5em; }
.toc[open] .toc-cover { animation: cover-open .7s var(--ease) .6s both; }
.toc.is-closing .toc-cover { animation: cover-close .36s var(--ease) both; }
@keyframes cover-open { from { transform: rotateY(0); } to { transform: rotateY(-108deg); } }
@keyframes cover-close { from { transform: rotateY(-108deg); } to { transform: rotateY(0); } }
.toc-head { display: flex; justify-content: space-between; align-items: center; min-height: 56px; padding-bottom: 12px; border-bottom: 2px solid var(--ink); }
.toc-title { font-family: var(--display); font-size: 26px; letter-spacing: .5em; }
.toc-close { min-width: 56px; min-height: 44px; padding: 0 14px; border: 1px solid var(--ink); border-radius: var(--radius); background: transparent; font-family: var(--serif); font-size: 15px; letter-spacing: .2em; }
.toc-list { flex: 1; padding: 10px 0 20px; }
.toc-list li { border-bottom: 1px solid var(--line); }
.toc-list a {
  display: grid; grid-template-columns: 2em auto 1fr auto; align-items: baseline; gap: 2px 10px;
  padding: 14px 0; min-height: 64px; text-decoration: none;
}
.toc-no { font-family: var(--serif); font-size: 15px; color: var(--ochre-text); }
.toc-name { font-family: var(--display); font-size: clamp(20px, 5.6vw, 26px); letter-spacing: .12em; line-height: 1.4; }
.toc-dots { border-bottom: 1px dotted #a9a291; transform: translateY(-6px); }
.toc-pg { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--muted); }
.toc-list small { grid-column: 2 / -1; font-size: 13px; color: var(--muted); letter-spacing: .06em; }
.toc[open] .toc-list li { animation: toc-item .5s var(--ease) backwards; animation-delay: calc(.9s + var(--i, 0) * 50ms); }
@keyframes toc-item { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
.toc-foot { display: grid; gap: 16px; padding-top: 18px; border-top: 2px solid var(--ink); }
.toc-foot .btn { width: 100%; }
.toc-foot p { font-size: 14px; color: var(--muted); line-height: 1.8; }
.toc.is-closing .toc-page { opacity: .6; transition: opacity .4s; }

/* ===== 響應式 ===== */
@media (max-width: 1180px) {
  .hero-inner { grid-template-columns: 1fr; }
  .today { justify-self: start; }
  .shelf-grid { grid-template-columns: 1fr; }
  .shelf-books { --sw: 1.2; --sh: 1; }
  .shelf-detail { min-height: 0; }
}
@media (max-width: 960px) {
  .nav, .header-cta { display: none; }
  .toc-toggle { display: inline-flex; }
  :root { --header-h: 64px; }
  .hero-media img { object-position: 72% 50%; }
  .hero::after { background: linear-gradient(to top, var(--paper) 0%, var(--paper) 38%, rgba(245, 242, 234, .9) 50%, rgba(245, 242, 234, 0) 64%); }
  .events-photo, .booklist-side, .visit-photos { order: 2; }
  .about-grid { grid-template-columns: 1fr; }
  .about-vertical { grid-column: 1; grid-row: 1; justify-self: end; height: 20em; margin-right: 0; }
  .about-body { grid-row: 2; padding-top: 0; }
  .picks-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pick:nth-child(3n + 2) { margin-top: 0; }
  .pick:nth-child(2n) { margin-top: clamp(40px, 8vw, 96px); }
  .sec-head--split { grid-template-columns: 1fr; }
  .firstlines { grid-template-columns: 1fr; }
  .fl-cols { position: absolute; inset: 0; width: 50%; opacity: .45; }
  .fl-cols--end { left: auto; right: 0; }
  .fl-center { z-index: 1; max-width: 30em; margin-inline: auto; background: var(--indigo-deep); box-shadow: 0 0 60px 40px var(--indigo-deep); }
  .events-grid, .booklist-grid, .visit-grid { grid-template-columns: 1fr; }
  .events-photo { min-height: 0; aspect-ratio: 16 / 10; }
  .booklist-photo { min-height: 0; aspect-ratio: 3 / 2; flex: none; }
  .visit-photos { min-height: 0; }
  .visit-photos .frame { aspect-ratio: 2 / 3; }
}
@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .hero { align-items: flex-end; }
  .hero-inner { padding-bottom: 88px; gap: 28px; }
  .hero-copy { gap: 18px; }
  .hero-catch { font-size: 15px; letter-spacing: .3em; padding-right: 10px; }
  .hero-title { font-size: clamp(42px, 12.4vw, 60px); letter-spacing: .1em; margin-bottom: 18px; }
  @keyframes spread-in { from { letter-spacing: -.42em; filter: blur(10px); opacity: 0; } to { letter-spacing: .1em; filter: blur(0); opacity: 1; } }
  .hero-lead { margin-bottom: 26px; }
  .hero-actions .btn { flex: 1 1 auto; }
  .today { display: none; }
  .ruled { font-size: 16px; }
  .about-vertical { height: 18em; font-size: 17px; letter-spacing: .22em; justify-self: center; }
  .picks-grid {
    grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 80%; gap: 18px;
    overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
    margin-inline: calc(var(--gutter) * -1); padding: 0 var(--gutter) 16px; scroll-padding-inline: var(--gutter);
  }
  .pick { scroll-snap-align: start; }
  .pick:nth-child(2n) { margin-top: 0; }
  .pick-stage { aspect-ratio: 16 / 12; }
  .book { width: 38%; }
  .shelf { min-height: 380px; padding: 40px 14px 0; }
  .shelf-books { gap: 3px; }
  .shelf-books { --sw: .74; --sh: .82; }
  .spine { font-size: 13px; letter-spacing: .14em; }
  .spine small, .shelf-pop { display: none; }
  .event { grid-template-columns: 4.8em minmax(0, 1fr); padding: 20px 4px; }
  .event-btn { grid-column: 2; justify-self: start; display: inline-flex; gap: 8px; align-items: center; min-height: 46px; }
  .event-date { font-size: 24px; }
  .closed-days { margin-top: -20px; font-size: 17px; gap: 6px 10px; }
  .slip-line { grid-template-columns: 4.8em minmax(0, 1fr); }
  .visit-photos .frame:last-child { margin-top: 40px; }
  .colophon-box dl div { grid-template-columns: 4.4em 1fr; }
  .colophon { padding-bottom: 88px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .hero-media img, .fl-col span { animation: none !important; }
  .toc[open] .toc-cover { animation: none !important; transform: rotateY(-108deg); opacity: 0; }
}
