/* =========================================================
   Karen Wilkins的文学世界 — editorial stylesheet
   ========================================================= */

:root {
  --serif: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif CJK SC", "Noto Serif SC", "SimSun", serif;
  --latin: "Cormorant Garamond", "EB Garamond", "Garamond", "Baskerville", "Times New Roman", Georgia, serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fs: 19px;
  --lh: 2;
  --wrap: 1180px;
  --nav-h: 68px;
}

[data-theme="paper"] {
  --bg: #f3eee5;
  --bg2: #ebe4d6;
  --card: #f8f4ec;
  --ink: #1f1c18;
  --ink2: #4b453d;
  --muted: #8a8174;
  --line: #d9d0c0;
  --accent: #8a5a2b;
  --sel: rgba(138, 90, 43, 0.16);
  --shadow: 0 24px 48px -24px rgba(40, 30, 15, 0.38);
}
[data-theme="sepia"] {
  --bg: #e9ddc5;
  --bg2: #e0d1b4;
  --card: #efe5d0;
  --ink: #2c2217;
  --ink2: #54442f;
  --muted: #877255;
  --line: #ccb892;
  --accent: #7b4a1f;
  --sel: rgba(123, 74, 31, 0.18);
  --shadow: 0 24px 48px -24px rgba(60, 40, 15, 0.42);
}
[data-theme="night"] {
  --bg: #111113;
  --bg2: #19191c;
  --card: #18181b;
  --ink: #e8e2d6;
  --ink2: #bcb5a8;
  --muted: #847e76;
  --line: #2b2a2d;
  --accent: #c9a56a;
  --sel: rgba(201, 165, 106, 0.2);
  --shadow: 0 24px 48px -20px rgba(0, 0, 0, 0.7);
}
[data-font="sans"] { --body-font: var(--sans); }
[data-font="serif"] { --body-font: var(--serif); }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.4s ease, color 0.4s ease;
}
::selection { background: var(--sel); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
kbd {
  font-family: var(--sans);
  font-size: 11px;
  padding: 1px 6px;
  border: 1px solid currentColor;
  border-radius: 4px;
  opacity: 0.5;
}
.font-serif-cn { font-family: var(--serif); }

/* poster container — shared */
.poster { position: relative; overflow: hidden; background: #121216; }
.poster img, .poster svg { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- reading progress ---------- */
.progress {
  position: fixed; top: 0; left: 0; z-index: 90;
  height: 2px; width: 0;
  background: var(--accent);
  transition: width 0.12s linear;
}

/* ---------- navigation ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 60;
  height: var(--nav-h);
  padding: 0 clamp(20px, 4vw, 48px);
  display: flex; align-items: center; justify-content: space-between;
  color: var(--ink);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
  transition: background 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}
.nav.on-dark {
  color: #ece5d8;
  background: transparent;
  border-bottom-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.brand { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.brand em { font-family: var(--latin); font-size: 23px; font-style: italic; letter-spacing: 0.01em; }
.brand span { font-family: var(--serif); font-size: 14px; letter-spacing: 0.18em; opacity: 0.75; }
.nav-links { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 30px); }
.nav-link {
  font-size: 13px; letter-spacing: 0.16em;
  opacity: 0.72;
  display: inline-flex; align-items: center; gap: 8px;
  transition: opacity 0.2s;
}
.nav-link:hover { opacity: 1; }
.nav-aa {
  font-family: var(--latin); font-size: 17px; letter-spacing: 0; font-style: italic;
  width: 34px; height: 34px; justify-content: center;
  border: 1px solid currentColor; border-radius: 50%;
  opacity: 0.6;
}

.settings {
  position: absolute; right: clamp(20px, 4vw, 48px); top: calc(var(--nav-h) - 4px);
  width: 264px; padding: 18px 20px;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid; gap: 14px;
}
.set-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--muted); letter-spacing: 0.1em; }
.seg { display: inline-flex; align-items: center; border: 1px solid var(--line); }
.seg button { padding: 5px 11px; font-size: 13px; color: var(--ink2); transition: background 0.2s; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { background: var(--bg2); }
.seg button.on { background: var(--ink); color: var(--bg); }
.seg-val { padding: 0 12px; font-family: var(--latin); font-size: 15px; color: var(--ink); border-left: 1px solid var(--line); border-right: 1px solid var(--line); line-height: 30px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 28px;
  font-size: 13px; letter-spacing: 0.24em;
  border: 1px solid currentColor;
  transition: background 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s;
}
.btn-light { background: #ece5d8; color: #121214; border-color: #ece5d8; }
.btn-light:hover { background: transparent; color: #ece5d8; }
.btn-ghost { color: #ece5d8; border-color: rgba(236, 229, 216, 0.35); }
.btn-ghost:hover { border-color: #ece5d8; }
.btn-dark { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-dark:hover { background: transparent; color: var(--ink); }
.btn-line { color: var(--ink); border-color: var(--line); }
.btn-line:hover { border-color: var(--ink); }

/* =========================================================
   HERO
   ========================================================= */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  background: #0c0c0e;
  color: #ece5d8;
  overflow: hidden;
  display: flex; align-items: center;
}
.hero-stars {
  position: absolute; inset: 0; opacity: 0.55;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 27% 72%, #fff 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 41% 33%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 58% 12%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 66% 81%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 79% 44%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 22%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 93% 67%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 7% 88%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 35% 92%, #fff 50%, transparent 51%);
  background-size: 640px 640px;
  animation: drift 120s linear infinite;
}
@keyframes drift { to { background-position: 640px -640px; } }
.hero-glow {
  position: absolute; right: 8%; bottom: -10%;
  width: 70vmin; height: 70vmin; border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 150, 90, 0.28), rgba(201, 150, 90, 0) 65%);
  filter: blur(10px);
}
.hero-inner {
  position: relative;
  width: 100%; max-width: var(--wrap);
  margin: 0 auto;
  padding: calc(var(--nav-h) + 48px) clamp(20px, 4vw, 48px) 96px;
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(40px, 6vw, 96px);
  align-items: center;
}
.hero-eyebrow {
  margin: 0 0 18px;
  font-family: var(--latin); font-style: italic;
  font-size: 18px; letter-spacing: 0.08em;
  color: #c9a56a;
  opacity: 0; animation: rise 1s var(--ease) 0.1s forwards;
}
.hero-title { margin: 0; font-weight: 400; line-height: 1; }
.hero-title em {
  display: block;
  font-family: var(--latin); font-style: italic; font-weight: 400;
  font-size: clamp(58px, 9vw, 132px);
  letter-spacing: -0.015em; line-height: 0.95;
  opacity: 0; animation: rise 1.2s var(--ease) 0.2s forwards;
}
.hero-title span {
  display: block; margin-top: 22px;
  font-family: var(--serif);
  font-size: clamp(24px, 3vw, 38px);
  letter-spacing: 0.42em;
  color: rgba(236, 229, 216, 0.86);
  opacity: 0; animation: rise 1.2s var(--ease) 0.35s forwards;
}
.hero-lede {
  margin: 36px 0 0; max-width: 30em;
  font-family: var(--serif); font-size: 16px; line-height: 2;
  color: rgba(236, 229, 216, 0.62);
  opacity: 0; animation: rise 1.2s var(--ease) 0.5s forwards;
}
.hero-stats {
  display: flex; gap: clamp(24px, 4vw, 48px);
  margin-top: 40px; padding-top: 26px;
  border-top: 1px solid rgba(236, 229, 216, 0.14);
  max-width: 34em;
  opacity: 0; animation: rise 1.2s var(--ease) 0.6s forwards;
}
.stat b small { font-size: 0.5em; margin-left: 2px; font-family: var(--serif); }
.stat b { display: block; font-family: var(--latin); font-weight: 400; font-size: 34px; line-height: 1; color: #ece5d8; }
.stat span { display: block; margin-top: 8px; font-size: 12px; letter-spacing: 0.2em; color: rgba(236, 229, 216, 0.45); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 40px; opacity: 0; animation: rise 1.2s var(--ease) 0.7s forwards; }

.hero-cover {
  margin: 0; justify-self: end; width: 100%; max-width: 400px;
  opacity: 0; animation: fadeIn 1.6s var(--ease) 0.4s forwards;
}
.hero-cover img {
  width: 100%; height: auto;
  box-shadow: 0 50px 90px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(236, 229, 216, 0.08);
}
.hero-cover figcaption {
  margin-top: 18px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-family: var(--serif); font-size: 12.5px; letter-spacing: 0.1em;
  color: rgba(236, 229, 216, 0.5);
}
.cap-quote { color: rgba(201, 165, 106, 0.85); }
.hero-scroll {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-family: var(--latin); font-style: italic; font-size: 13px; letter-spacing: 0.2em;
  color: rgba(236, 229, 216, 0.45);
}
.hero-scroll i { width: 1px; height: 40px; background: linear-gradient(rgba(236, 229, 216, 0.5), transparent); animation: pulse 2.4s ease-in-out infinite; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 0.3; transform: scaleY(0.6); transform-origin: top; } 50% { opacity: 1; transform: scaleY(1); transform-origin: top; } }

/* =========================================================
   SECTIONS
   ========================================================= */
.section { max-width: var(--wrap); margin: 0 auto; padding: clamp(80px, 11vw, 140px) clamp(20px, 4vw, 48px) 0; }
.sec-head {
  display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: 28px;
  padding-bottom: 28px; margin-bottom: 8px;
  border-bottom: 1px solid var(--ink);
}
.sec-no { font-family: var(--latin); font-style: italic; font-size: clamp(56px, 7vw, 88px); line-height: 0.8; color: var(--accent); }
.sec-titles h2 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: clamp(26px, 3vw, 34px); letter-spacing: 0.24em; }
.sec-titles p { margin: 6px 0 0; font-family: var(--latin); font-style: italic; font-size: 17px; color: var(--muted); letter-spacing: 0.04em; }
.sec-tools { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; justify-content: flex-end; }
.filters { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.filters button, .views button {
  font-size: 13px; letter-spacing: 0.12em; color: var(--muted);
  padding: 4px 0; border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.filters button sup { font-family: var(--latin); font-size: 11px; margin-left: 3px; }
.filters button:hover, .views button:hover { color: var(--ink); }
.filters button.on, .views button.on { color: var(--ink); border-bottom-color: var(--ink); }
.views { display: flex; gap: 14px; padding-left: 24px; border-left: 1px solid var(--line); }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- featured ---------- */
.feat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 clamp(32px, 5vw, 72px); }
.feat {
  display: grid; grid-template-columns: minmax(150px, 210px) 1fr; gap: clamp(22px, 3vw, 36px);
  padding: 40px 0; cursor: pointer;
}
.feat-poster { aspect-ratio: 2 / 3; box-shadow: var(--shadow); transition: transform 0.7s var(--ease), box-shadow 0.7s var(--ease); }
.feat:hover .feat-poster { transform: translateY(-8px); }
.feat-body { display: flex; flex-direction: column; padding-top: 4px; }
.feat-no { font-family: var(--latin); font-style: italic; font-size: 15px; color: var(--accent); letter-spacing: 0.06em; }
.feat-title { margin: 12px 0 0; font-family: var(--serif); font-weight: 600; font-size: clamp(30px, 3.4vw, 42px); letter-spacing: 0.2em; line-height: 1.2; }
.feat-sub { margin: 10px 0 0; font-size: 13px; color: var(--muted); letter-spacing: 0.08em; }
.feat-quote { margin: auto 0 0; padding: 24px 0 0; font-family: var(--serif); font-size: 16px; line-height: 1.9; color: var(--ink2); }
.feat-actions { display: flex; gap: 22px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.link-btn { font-size: 13px; letter-spacing: 0.14em; color: var(--ink); position: relative; }
.link-btn::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform 0.4s var(--ease); }
.link-btn:hover::after { transform: scaleX(1); }
.link-btn.muted { color: var(--muted); }

/* ---------- index: list ---------- */
.index-list { counter-reset: row; }
.row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 120px 150px 86px 28px;
  align-items: center; gap: 20px;
  padding: 28px 12px;
  border-bottom: 1px solid var(--line);
  transition: background 0.35s var(--ease);
}
.row:hover { background: var(--bg2); }
.row-num { font-family: var(--latin); font-style: italic; font-size: 22px; color: var(--muted); transition: color 0.3s; }
.row-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.row-title {
  font-family: var(--serif); font-size: clamp(20px, 2.3vw, 27px); line-height: 1.35; letter-spacing: 0.06em;
  transition: transform 0.5s var(--ease), color 0.3s;
}
.row-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-cat, .row-date, .row-len { font-size: 12.5px; color: var(--muted); letter-spacing: 0.06em; }
.row-len { text-align: right; font-family: var(--latin); font-size: 15px; }
.row-arrow { font-family: var(--latin); font-size: 20px; color: var(--muted); transition: transform 0.5s var(--ease), color 0.3s; }
.row:hover .row-title { transform: translateX(8px); color: var(--accent); }
.row:hover .row-num, .row:hover .row-arrow { color: var(--ink); }
.row:hover .row-arrow { transform: translateX(6px); }

/* ---------- index: poster wall ---------- */
.index-wall {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 56px clamp(20px, 3vw, 40px);
  padding-top: 48px;
}
.tile { display: block; }
.tile .poster { aspect-ratio: 2 / 3; box-shadow: var(--shadow); transition: transform 0.7s var(--ease); }
.tile:hover .poster { transform: translateY(-8px); }
.tile-cap { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin-top: 18px; }
.tile-num { font-family: var(--latin); font-style: italic; font-size: 18px; color: var(--accent); grid-row: span 2; line-height: 1.3; }
.tile-title { font-family: var(--serif); font-size: 16px; line-height: 1.5; letter-spacing: 0.04em; }
.tile-meta { font-size: 12px; color: var(--muted); }

/* ---------- hover preview ---------- */
.hover-preview {
  position: fixed; left: 0; top: 0; z-index: 70;
  width: 190px; aspect-ratio: 2 / 3;
  pointer-events: none; overflow: hidden;
  background: #121216;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.55);
  opacity: 0; transform: translate3d(-9999px, 0, 0) scale(0.92);
  transition: opacity 0.3s var(--ease), transform 0.18s var(--ease);
}
.hover-preview.show { opacity: 1; }
.hover-preview img, .hover-preview svg { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- footer ---------- */
.foot { text-align: center; padding: clamp(110px, 14vw, 170px) 24px 80px; }
.foot-mark em { font-family: var(--latin); font-style: italic; font-size: clamp(40px, 5vw, 60px); }
.foot-line { margin: 8px 0 0; font-family: var(--serif); letter-spacing: 0.4em; color: var(--muted); font-size: 13px; }
.foot-quote { margin: 40px auto 0; font-family: var(--serif); font-size: 14px; color: var(--muted); letter-spacing: 0.1em; }

/* =========================================================
   READER
   ========================================================= */
#view-reader { padding-top: var(--nav-h); min-height: 100vh; }
.r-head {
  max-width: 1100px; margin: 0 auto;
  padding: clamp(48px, 7vw, 96px) clamp(20px, 4vw, 48px) clamp(48px, 6vw, 72px);
  display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: clamp(36px, 6vw, 80px);
  align-items: end;
  border-bottom: 1px solid var(--line);
}
.r-back { display: inline-block; margin-bottom: 40px; font-size: 13px; letter-spacing: 0.16em; color: var(--muted); transition: color 0.2s; }
.r-back:hover { color: var(--ink); }
.r-kicker { font-size: 12.5px; letter-spacing: 0.24em; color: var(--accent); }
.r-kicker i { font-style: normal; margin: 0 10px; opacity: 0.5; }
.r-title { margin: 20px 0 0; font-family: var(--serif); font-weight: 600; font-size: clamp(32px, 4.8vw, 60px); line-height: 1.22; letter-spacing: 0.08em; }
.r-sub { margin: 16px 0 0; font-size: 14px; color: var(--muted); letter-spacing: 0.1em; }
.r-quote { margin: 36px 0 0; padding-left: 22px; border-left: 1px solid var(--accent); font-family: var(--serif); font-size: 16.5px; line-height: 1.95; color: var(--ink2); max-width: 34em; }
.r-meta { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-top: 36px; font-size: 12.5px; color: var(--muted); letter-spacing: 0.12em; }
.r-meta a { color: var(--ink); border-bottom: 1px solid var(--line); }
.r-poster { margin: 0; aspect-ratio: 2 / 3; box-shadow: var(--shadow); cursor: zoom-in; transition: transform 0.6s var(--ease); }
.r-poster:hover { transform: translateY(-6px); }
.r-poster-alt { margin-top: 14px; font-size: 12px; letter-spacing: 0.14em; color: var(--muted); text-align: center; width: 100%; }
.r-poster-alt:hover { color: var(--ink); }

/* prose */
.prose {
  max-width: 35em; margin: 0 auto;
  padding: clamp(56px, 8vw, 96px) 24px 0;
  font-family: var(--body-font);
  font-size: var(--fs); line-height: var(--lh);
  color: var(--ink);
  letter-spacing: 0.02em;
}
.prose p { margin: 0 0 0.95em; text-align: justify; text-justify: inter-ideograph; word-break: break-word; }
.prose p.body { text-indent: 2em; }
.prose p.lead { text-indent: 0; }
.prose p.lead::first-letter {
  float: left; font-size: 3.3em; line-height: 1; margin: 0.06em 0.14em 0 0;
  font-family: var(--serif); color: var(--accent);
}
.prose p.mark { margin: 2.6em 0 1.4em; text-align: center; font-family: var(--latin); font-style: italic; font-size: 1.05em; color: var(--accent); letter-spacing: 0.2em; }
.prose p.date { margin: 2.6em 0 0.6em; text-align: right; font-size: 0.8em; color: var(--muted); letter-spacing: 0.14em; }
.prose p.note { margin: 1.6em 0; padding-top: 1em; border-top: 1px solid var(--line); font-size: 0.82em; line-height: 1.85; color: var(--muted); }
.prose p.flash { animation: flash 2.4s ease; }
@keyframes flash { 0%, 40% { background: var(--sel); } 100% { background: transparent; } }

.chapter { scroll-margin-top: calc(var(--nav-h) + 24px); }
.ch { text-align: center; margin: 5.5em 0 3em; }
.chapter:first-child .ch { margin-top: 0; }
.ch-num { display: block; font-family: var(--latin); font-style: italic; font-size: 0.95em; color: var(--accent); letter-spacing: 0.12em; }
.ch-title { margin: 0.5em 0 0; font-family: var(--serif); font-weight: 600; font-size: 1.45em; letter-spacing: 0.22em; line-height: 1.5; }
.ch::after { content: ""; display: block; width: 36px; height: 1px; margin: 1.4em auto 0; background: var(--ink); opacity: 0.4; }

.fin { margin: 5em 0 0; text-align: center; font-family: var(--serif); letter-spacing: 0.6em; color: var(--muted); font-size: 15px; }
.fin::before, .fin::after { content: "—"; margin: 0 0.6em; letter-spacing: 0; }

/* side chapter nav */
.side-toc {
  position: fixed; left: clamp(20px, 3vw, 48px); top: 50%; transform: translateY(-50%);
  width: 190px; max-height: 70vh; overflow-y: auto;
  display: none;
  scrollbar-width: none;
}
.side-toc::-webkit-scrollbar { display: none; }
.side-toc.visible { display: block; }
.side-toc-label { font-family: var(--latin); font-style: italic; font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.side-toc a {
  display: flex; gap: 12px; align-items: baseline;
  padding: 6px 0; font-size: 12.5px; line-height: 1.5; color: var(--muted);
  transition: color 0.25s;
}
.side-toc a::before { content: ""; flex: none; width: 12px; height: 1px; background: currentColor; transform: translateY(-4px); transition: width 0.35s var(--ease); }
.side-toc a:hover { color: var(--ink); }
.side-toc a.on { color: var(--ink); }
.side-toc a.on::before { width: 24px; background: var(--accent); }

/* prev / next */
.pn {
  max-width: 1100px; margin: clamp(80px, 10vw, 120px) auto 0;
  padding: 0 clamp(20px, 4vw, 48px) 100px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  border-top: 1px solid var(--line);
}
.pn a { display: grid; grid-template-columns: 64px 1fr; gap: 20px; align-items: center; padding: 36px 0; transition: opacity 0.3s; }
.pn a + a, .pn .pn-empty + a { border-left: 1px solid var(--line); padding-left: 32px; }
.pn a.next { grid-template-columns: 1fr 64px; text-align: right; }
.pn a.next .poster { order: 2; }
.pn .poster { aspect-ratio: 2 / 3; box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.5); }
.pn small { display: block; font-size: 12px; color: var(--muted); letter-spacing: 0.2em; }
.pn strong { display: block; margin-top: 8px; font-family: var(--serif); font-weight: 600; font-size: 19px; letter-spacing: 0.06em; line-height: 1.4; transition: color 0.3s; }
.pn a:hover strong { color: var(--accent); }

/* embed */
.embed { max-width: 1240px; margin: 0 auto; padding: clamp(40px, 6vw, 64px) clamp(20px, 4vw, 48px) 0; }
.embed-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 18px;
  border: 1px solid var(--line); border-bottom: 0;
  background: var(--card);
}
.embed-url { display: inline-flex; align-items: center; gap: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.embed-url::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #4f9d6d; flex: none; }
.embed-actions { display: flex; gap: 22px; }
.embed-actions button, .embed-actions a { font-size: 12.5px; letter-spacing: 0.14em; color: var(--ink2); }
.embed-actions button:hover, .embed-actions a:hover { color: var(--accent); }
.embed-frame { height: 84vh; min-height: 560px; border: 1px solid var(--line); background: #0b0b0d; }
.embed-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.embed-note { margin: 14px 0 0; font-size: 12px; color: var(--muted); text-align: center; letter-spacing: 0.08em; }

/* =========================================================
   OVERLAYS
   ========================================================= */
.palette, .lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 10, 12, 0.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade 0.25s ease;
}
@keyframes fade { from { opacity: 0; } }
.palette-panel {
  width: min(680px, calc(100% - 32px));
  margin: 12vh auto 0;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.6);
  animation: drop 0.35s var(--ease);
}
@keyframes drop { from { opacity: 0; transform: translateY(-12px); } }
.palette-input { display: flex; align-items: center; gap: 14px; padding: 20px 22px; border-bottom: 1px solid var(--line); color: var(--muted); }
.palette-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-family: var(--serif); font-size: 19px; }
.palette-results { max-height: 58vh; overflow-y: auto; padding: 8px; }
.pr-empty { padding: 36px 16px; text-align: center; font-size: 13.5px; color: var(--muted); letter-spacing: 0.08em; }
.pr-item { display: block; width: 100%; text-align: left; padding: 14px 16px; border-left: 2px solid transparent; }
.pr-item.sel, .pr-item:hover { background: var(--bg2); border-left-color: var(--accent); }
.pr-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.pr-title { font-family: var(--serif); font-weight: 600; font-size: 15px; letter-spacing: 0.04em; }
.pr-where { color: var(--muted); font-size: 12px; white-space: nowrap; }
.pr-snip { margin-top: 6px; font-family: var(--serif); font-size: 13.5px; line-height: 1.75; color: var(--ink2); }
.pr-snip mark { background: none; color: var(--accent); border-bottom: 1px solid var(--accent); }

.lightbox { display: flex; align-items: center; justify-content: center; padding: 24px; }
.lightbox-inner {
  width: min(960px, 100%); max-height: calc(100vh - 48px); overflow-y: auto;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  background: var(--card); color: var(--ink);
  box-shadow: 0 50px 100px -30px rgba(0, 0, 0, 0.7);
  animation: drop 0.4s var(--ease);
}
.lightbox-poster { margin: 0; background: #0c0c0e; display: flex; align-items: center; justify-content: center; padding: clamp(20px, 4vw, 40px); }
.lightbox-poster img, .lightbox-poster svg { width: 100%; max-width: 400px; height: auto; display: block; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.8); }
.lightbox-info { padding: clamp(28px, 4vw, 48px); display: flex; flex-direction: column; }
.lb-kicker { margin: 0; font-size: 12px; letter-spacing: 0.22em; color: var(--accent); }
.lb-title { margin: 14px 0 0; font-family: var(--serif); font-weight: 600; font-size: 28px; letter-spacing: 0.1em; line-height: 1.35; }
.lb-style { margin: 18px 0 0; font-family: var(--latin); font-style: italic; font-size: 16px; color: var(--ink2); line-height: 1.6; }
.lb-notes { margin: 18px 0 0; font-family: var(--serif); font-size: 14px; line-height: 2; color: var(--muted); }
.lb-actions { display: flex; gap: 12px; margin-top: auto; padding-top: 32px; }
.lb-actions .btn { flex: 1; padding: 12px 16px; }

.toast {
  position: fixed; left: 50%; bottom: 32px; z-index: 95; transform: translateX(-50%);
  display: flex; align-items: center; gap: 18px;
  padding: 14px 20px;
  background: var(--ink); color: var(--bg);
  font-size: 13px; letter-spacing: 0.08em;
  box-shadow: 0 20px 40px -16px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.5s var(--ease);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 16px); } }
.toast button { font-size: 13px; color: var(--bg); border-bottom: 1px solid currentColor; letter-spacing: 0.1em; }
.toast .toast-x { border: 0; opacity: 0.5; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (min-width: 1360px) {
  .side-toc.has { display: block; opacity: 0; pointer-events: none; transition: opacity 0.5s var(--ease); }
  .side-toc.has.show { opacity: 1; pointer-events: auto; }
}
@media (max-width: 1080px) {
  .row { grid-template-columns: 56px minmax(0, 1fr) 120px 28px; }
  .row-date, .row-len { display: none; }
}
@media (max-width: 920px) {
  .hero-inner { grid-template-columns: 1fr; padding-bottom: 120px; }
  .hero-cover { justify-self: start; max-width: 300px; order: -1; }
  .br-wide { display: none; }
  .sec-head { grid-template-columns: auto 1fr; }
  .sec-tools { grid-column: 1 / -1; justify-content: flex-start; }
  .feat-grid { grid-template-columns: 1fr; }
  .r-head { grid-template-columns: 1fr; }
  .r-poster-col { order: -1; max-width: 220px; }
  .lightbox-inner { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .nav-link[data-scroll] { display: none; }
  .brand em { font-size: 20px; }
  .brand span { font-size: 12px; letter-spacing: 0.1em; }
  .hero-stats { gap: 22px; }
  .stat b { font-size: 26px; }
  .feat { grid-template-columns: 120px 1fr; padding: 32px 0; }
  .feat-title { font-size: 26px; }
  .feat-quote { display: none; }
  .row { grid-template-columns: 40px minmax(0, 1fr) 20px; padding: 22px 4px; gap: 12px; }
  .row-cat { display: none; }
  .index-wall { grid-template-columns: repeat(2, 1fr); gap: 36px 16px; }
  .pn { grid-template-columns: 1fr; }
  .pn a + a, .pn .pn-empty + a { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); }
  .prose { padding-left: 20px; padding-right: 20px; }
  .embed-frame { height: 74vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal, .hero-eyebrow, .hero-title em, .hero-title span, .hero-lede, .hero-stats, .hero-cta, .hero-cover { opacity: 1 !important; transform: none !important; }
}
