/* ==========================================================================
   default theme — three-column reading layout
   Every colour and metric is a custom property, so a variant theme can be
   built by overriding the :root block alone.
   ========================================================================== */

:root {
  --font-serif: Lora, "Noto Serif SC", Georgia, "Songti SC", "Source Han Serif SC", serif;
  --font-sans: Montserrat, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "Fira Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --sidebar-width: 280px;
  --rail-width: 280px;
  --column-width: 720px;

  --bg: #fcfcfc;
  --surface: #ffffff;
  --surface-alt: #f2f4f7;
  --text: #101012;
  --text-strong: #000000;
  --text-muted: #6b6f76;
  --text-faint: #9aa0a8;
  --divider: rgba(128, 128, 128, 0.16);
  --accent: #3d6fd6;
  --accent-soft: rgba(61, 111, 214, 0.1);
  --code-bg: #f6f8fa;
  --code-text: #24292e;
  --shadow: 0 1px 2px rgba(16, 16, 18, 0.05), 0 10px 30px rgba(16, 16, 18, 0.05);
}

/* "auto" tracks the operating system; the toggle pins it by setting
   data-scheme to an explicit value, which wins over this block. */
@media (prefers-color-scheme: dark) {
  html[data-scheme="auto"] {
    --bg: #17181b;
    --surface: #1f2024;
    --surface-alt: #26272c;
    --text: #e8e8ea;
    --text-strong: #ffffff;
    --text-muted: #9ba1a9;
    --text-faint: #71767e;
    --divider: rgba(160, 160, 170, 0.16);
    --accent: #7aa2f7;
    --accent-soft: rgba(122, 162, 247, 0.14);
    --code-bg: #16171a;
    --code-text: #d7dbe0;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.3);
  }
}

html[data-scheme="dark"] {
  --bg: #17181b;
  --surface: #1f2024;
  --surface-alt: #26272c;
  --text: #e8e8ea;
  --text-strong: #ffffff;
  --text-muted: #9ba1a9;
  --text-faint: #71767e;
  --divider: rgba(160, 160, 170, 0.16);
  --accent: #7aa2f7;
  --accent-soft: rgba(122, 162, 247, 0.14);
  --code-bg: #16171a;
  --code-text: #d7dbe0;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* --- base ---------------------------------------------------------------- */

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; height: auto; }

.icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-inline {
  width: 15px;
  height: 15px;
  vertical-align: -2px;
  margin-right: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 10px 16px;
  background: var(--surface);
  z-index: 100;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* --- sidebar ------------------------------------------------------------- */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 24px 0 40px;
  display: flex;
  flex-direction: column;
  text-align: right;
  font-family: var(--font-sans);
  overflow-y: auto;
}

.nav-head {
  display: block;
  padding: 26px 30px 26px 20px;
  border-right: 3px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.nav-head:hover { background: var(--surface-alt); }
.nav-head.is-active {
  background: var(--surface-alt);
  border-right-color: var(--accent);
}

.nav-title {
  display: flex;
  justify-content: flex-end;
  color: var(--text-strong);
  line-height: 0;
}
.nav-subtitle { margin-top: 6px; font-size: 17px; color: var(--text-muted); }

.site-wordmark {
  position: relative;
  display: inline-flex;
  width: 100%;
  color: inherit;
  line-height: 0;
}

.site-wordmark-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.site-wordmark-fallback {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.nav-title .site-wordmark { width: 190px; }

.nav-links { margin-top: 28px; display: flex; flex-direction: column; }

.nav-link {
  padding: 8px 30px 8px 20px;
  font-size: 19px;
  color: var(--text-muted);
  border-right: 3px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.nav-link:hover { color: var(--text); background: var(--surface-alt); }
.nav-link.is-active {
  color: var(--text);
  background: var(--surface-alt);
  border-right-color: var(--accent);
}

.nav-footer {
  margin-top: auto;
  padding: 24px 30px 0 20px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-faint);
}
.nav-footer a { color: var(--accent); }
.nav-footer a:hover { text-decoration: underline; }
.nav-copyright { margin-top: 10px; }

/* --- control rail -------------------------------------------------------- */

.rail {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--rail-width);
  height: 100vh;
  padding: 0 26px 40px 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
  pointer-events: none;
}

.rail-button {
  pointer-events: auto;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, opacity 0.2s ease;
}
.rail-button:hover { color: var(--text); background: var(--surface-alt); }
.rail-button.is-hidden { opacity: 0; visibility: hidden; }

.rail-indicator {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-faint);
  width: 42px;
}
.rail-indicator-rule {
  width: 14px;
  height: 1px;
  background: currentColor;
  transform: rotate(-28deg);
}

/* --- article table of contents ------------------------------------------ */

.post-toc {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
}

.post-toc-rail {
  align-self: stretch;
  max-height: calc(100vh - 170px);
  margin: 36px 18px auto 28px;
  overflow-y: auto;
  pointer-events: auto;
  scrollbar-width: thin;
}

.post-toc-title {
  margin-bottom: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.post-toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-toc-item { margin: 1px 0; }

.post-toc-link {
  display: block;
  padding: 5px 8px;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  color: var(--text-faint);
  overflow-wrap: anywhere;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.post-toc-link:hover { color: var(--text); background: var(--surface-alt); }
.post-toc-link.is-active {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.toc-level-3 .post-toc-link { padding-left: 20px; }
.toc-level-4 .post-toc-link { padding-left: 32px; font-size: 12px; }
.toc-level-5 .post-toc-link { padding-left: 44px; font-size: 12px; }
.toc-level-6 .post-toc-link { padding-left: 56px; font-size: 12px; }

.post-toc-mobile {
  display: none;
  margin: 0 36px 10px;
  border: 1px solid var(--divider);
  border-radius: 4px;
  font-family: var(--font-sans);
}
.post-toc-mobile summary {
  padding: 10px 14px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.post-toc-inline {
  max-height: min(50vh, 420px);
  padding: 0 10px 12px;
  overflow-y: auto;
}
.post-toc-inline .post-toc-title { display: none; }

/* --- single-column chrome (hidden on wide screens) ----------------------- */

.topbar,
.drawer,
.mobile-head { display: none; }

/* --- content ------------------------------------------------------------- */

.stream {
  margin: 0 var(--rail-width) 0 var(--sidebar-width);
  padding: 0;
}

.card {
  max-width: var(--column-width);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 60px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.card-flat { box-shadow: none; }

.empty { padding: 60px 36px; color: var(--text-muted); text-align: center; }

/* --- post stream --------------------------------------------------------- */

.post-item { margin: 0 30px; border-bottom: 1px solid var(--divider); }
.post-item:last-child { border-bottom: 0; }

.post-item-link {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 28px 6px;
}
.post-item-body {
  flex: 1 1 auto;
  min-width: 0; /* 允许标题摘要收缩，把空间留给右侧缩略图 */
}

.post-item-title {
  margin: 0 0 10px;
  font-size: 27px;
  font-weight: 600;
  line-height: 1.55;
  letter-spacing: 0.01em;
  color: var(--text-strong);
  -webkit-text-stroke: 0.3px currentColor;
  transition: color 0.15s ease;
}
.post-item-link:hover .post-item-title { color: var(--accent); }

.post-item-summary {
  margin: 0 0 10px;
  color: var(--text-muted);
  line-height: 1.85;
  letter-spacing: 0.01em;
}

/* 列表右侧头图：宽度随栏宽自适应，高度按 4:3 比例，图片 cover 填满 */
.post-item-thumb {
  flex: 0 0 auto;
  width: clamp(100px, 24%, 160px);
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-alt);
  box-shadow: var(--shadow);
}
.post-item-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* 窄屏手机竖屏：列表不显示头图，把宽度留给标题与摘要。
   平板、手机横屏（视口够宽）再显示。断点按宽度，不依赖设备类型。 */
@media (max-width: 639px) {
  .post-item-thumb { display: none; }
  .post-item-link { gap: 0; }
}

.meta {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-faint);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
}
.meta-group { display: inline-flex; align-items: center; gap: 10px; }
.meta-link { color: var(--text-muted); }
.meta-link:hover { color: var(--accent); text-decoration: underline; }

/* --- pager (shown when the rail is not available) ------------------------ */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--column-width);
  margin: 0 auto;
  padding: 26px 30px 40px;
  font-family: var(--font-sans);
  font-size: 14px;
}
.pager-status { color: var(--text-faint); }
.pager-link {
  padding: 8px 16px;
  border: 1px solid var(--divider);
  border-radius: 999px;
  color: var(--text-muted);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.pager-link:hover { color: var(--accent); border-color: var(--accent); }

/* The rail already carries page arrows on wide screens. */
@media (min-width: 1024px) {
  .pager { display: none; }
}

/* --- page headers -------------------------------------------------------- */

.page-head {
  padding: 30px 36px 22px;
  border-bottom: 1px solid var(--divider);
}
.page-eyebrow {
  margin: 0 0 6px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-faint);
}
.page-eyebrow a:hover { color: var(--accent); }
.page-title {
  margin: 0;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.01em;
  color: var(--text-strong);
  -webkit-text-stroke: 0.32px currentColor;
}
.page-subtitle {
  margin: 6px 0 0;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-faint);
}

/* --- archive ------------------------------------------------------------- */

.archive-year { padding: 8px 36px 20px; }
.archive-year-title {
  margin: 22px 0 10px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-faint);
  letter-spacing: 0.08em;
}

.archive-list { margin: 0; padding: 0 36px; list-style: none; }
.archive-year .archive-list { padding: 0; }

.archive-entry {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--divider);
}
.archive-entry:last-child { border-bottom: 0; }

.archive-date {
  flex: none;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
}
.archive-link { line-height: 1.8; letter-spacing: 0.01em; }
.archive-link:hover { color: var(--accent); }

/* --- taxonomy cloud ------------------------------------------------------ */

.term-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 26px 36px 40px;
}
.term-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface-alt);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-muted);
  transition: color 0.15s ease, background 0.15s ease;
}
.term-chip:hover { color: var(--accent); background: var(--accent-soft); }
.term-count { font-size: 12px; color: var(--text-faint); }

/* --- single post --------------------------------------------------------- */

.post-cover img { display: block; width: 100%; object-fit: cover; max-height: 320px; }

.post-head { padding: 30px 36px 20px; border-bottom: 1px solid var(--divider); }
.post-title {
  margin: 0 0 12px;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: var(--text-strong);
  -webkit-text-stroke: 0.32px currentColor;
}

/* Chinese text is denser than Latin: the same point size reads smaller and
   needs more air between lines. 17px / 1.95 with a hair of tracking is the
   comfortable range for a ~37-character measure. */
.post-body {
  padding: 26px 36px 10px;
  font-size: 17px;
  line-height: 1.95;
  letter-spacing: 0.01em;
  overflow-wrap: break-word;
  /* Keeps a lone character from being pushed onto its own last line, which
     happens constantly with CJK. Ignored where unsupported. */
  text-wrap: pretty;
}

/* Most CJK fonts ship no bold face, and browsers do not synthesise one for
   them, so font-weight alone leaves <strong> looking identical to body text —
   the emphasis simply disappears. A hairline stroke thickens the glyphs
   whatever the font, and the colour lift carries the emphasis even where the
   stroke is unsupported. Both are deliberately small: on a font that does have
   a real bold they add to it rather than replace it. */
.post-body strong,
.post-body b {
  font-weight: 700;
  color: var(--text-strong);
  -webkit-text-stroke: 0.3px currentColor;
}

/* Italic CJK is synthesised by shearing the glyphs, which looks broken. Marks
   run alongside the text instead — the conventional Chinese emphasis. */
.post-body em,
.post-body i {
  font-style: italic;
  color: var(--text-strong);
}

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4 {
  /* More space above than below, so a heading groups with the text it
     introduces instead of floating between two blocks. */
  margin: 2.2em 0 0.8em;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: var(--text-strong);
  /* Same reason as <strong>: without this a CJK heading is only larger, not
     heavier, and the hierarchy reads weakly. */
  -webkit-text-stroke: 0.3px currentColor;
}
.post-body > *:first-child { margin-top: 0; }
.post-body h1 { font-size: 28px; }
.post-body h2 { font-size: 24px; }
.post-body h3 { font-size: 20px; }
.post-body h4 { font-size: 17.5px; }
.post-body h2,
.post-body h3,
.post-body h4,
.post-body h5,
.post-body h6 { scroll-margin-top: 72px; }

/* Chinese prose has no paragraph indent on the web, so the gap between
   paragraphs is the only separator and has to be clearly wider than the line
   gap — otherwise the page reads as one undifferentiated block. */
.post-body p { margin: 1.35em 0; }

/* Underlining on hover only: a permanently underlined link cuts through the
   descenders and the dense strokes of Chinese characters. */
.post-body a {
  color: var(--accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.post-body a:hover { text-decoration: underline; }

.post-body ul,
.post-body ol { padding-left: 1.6em; }
.post-body li { margin: 0.5em 0; }
.post-body li > ul,
.post-body li > ol { margin: 0.4em 0; }

.post-body blockquote {
  margin: 1.6em 0;
  padding: 2px 0 2px 20px;
  border-left: 3px solid var(--divider);
  color: var(--text-muted);
}
.post-body blockquote p { margin: 0.7em 0; }

.post-body hr { margin: 2.4em 0; border: 0; border-top: 1px solid var(--divider); }

.post-body img { border-radius: 3px; }

/* An image on its own line becomes a figure: given more room than a paragraph
   break, centred, and captioned from its alt text when there is one. */
.post-figure {
  margin: 2em 0;
  text-align: center;
}
.post-figure img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  border-radius: 4px;
  /* Screenshots are usually light; on a dark page a hairline edge keeps them
     from appearing to float, and on a light page it separates white from
     white. */
  border: 1px solid var(--divider);
}
.post-figure a { display: block; }

.post-figure figcaption {
  margin-top: 10px;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.7;
  letter-spacing: normal;
  color: var(--text-faint);
}

/* Full-bleed on narrow screens: a 20px gutter either side wastes a lot of a
   phone's width when the content is a screenshot. */
@media (max-width: 1023px) {
  .post-figure {
    margin: 1.6em -20px;
  }
  .post-figure img { border-radius: 0; border-left: 0; border-right: 0; }
  .post-figure figcaption { padding: 0 20px; }
}

/* Stands in for an image whose host is gone, so the gap in the article is
   visible without the browser attempting a doomed cross-origin fetch. */
.asset-missing {
  display: inline-block;
  padding: 6px 12px;
  border: 1px dashed var(--divider);
  border-radius: 3px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-faint);
  cursor: help;
}

/* Code opts out of the prose tracking: monospace alignment depends on the
   font's own advance widths. */
.post-body code {
  padding: 2px 5px;
  border-radius: 3px;
  background: var(--surface-alt);
  font-family: var(--font-mono);
  font-size: 0.86em;
  letter-spacing: normal;
}

.post-body pre {
  margin: 1.5em 0;
  padding: 16px 18px;
  border-radius: 4px;
  background: var(--code-bg);
  color: var(--code-text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  letter-spacing: normal;
  overflow-x: auto;
}
.post-body pre code { padding: 0; background: none; font-size: inherit; }

/* Legacy posts include wide tables; keep them from pushing the layout out. */
.post-body table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1.4em 0;
  font-size: 14px;
}
.post-body th,
.post-body td { padding: 8px 12px; border: 1px solid var(--divider); text-align: left; }
.post-body th { background: var(--surface-alt); font-weight: 600; }

/* Heading anchors, revealed on hover. */
.post-body .anchor {
  margin-left: 8px;
  color: var(--text-faint);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.post-body h1:hover .anchor,
.post-body h2:hover .anchor,
.post-body h3:hover .anchor,
.post-body h4:hover .anchor { opacity: 1; }

.footnotes { margin-top: 2.4em; padding-top: 1em; border-top: 1px solid var(--divider); font-size: 14px; color: var(--text-muted); }

/* --- paywall ------------------------------------------------------------- */

.paywall { margin: 0 36px 10px; font-family: var(--font-sans); }

/* The article does not simply stop: the rule marks the boundary as deliberate. */
.paywall-rule {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 8px 0 24px;
  font-size: 13px;
  color: var(--text-faint);
  white-space: nowrap;
}
.paywall-rule::before,
.paywall-rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--divider);
}

.paywall-outline {
  padding: 18px 22px;
  border: 1px solid var(--divider);
  border-radius: 4px;
  background: var(--surface-alt);
}
.paywall-outline-label { margin: 0 0 10px; font-size: 12px; color: var(--text-faint); }
.paywall-outline ul { margin: 0; padding: 0; list-style: none; }
.paywall-outline li {
  padding: 5px 0 5px 18px;
  font-size: 14.5px;
  color: var(--text-muted);
  position: relative;
}
.paywall-outline li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 13px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--divider);
}
.paywall-outline-l3 { padding-left: 36px !important; font-size: 13.5px !important; }
.paywall-outline-l3::before { left: 20px !important; }
.paywall-outline-l4 { padding-left: 52px !important; font-size: 13.5px !important; }
.paywall-outline-l4::before { left: 36px !important; }

.paywall-meta { margin: 16px 0 18px; font-size: 13px; color: var(--text-faint); }

.paywall-buy {
  display: inline-block;
  padding: 12px 30px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  line-height: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: opacity 0.15s ease;
}
.paywall-buy:hover { opacity: 0.88; }
.paywall-purchase-form { margin: 0; }

.paywall-note { margin: 16px 0 0; font-size: 12.5px; line-height: 1.7; color: var(--text-faint); }
.paywall-note a { color: var(--accent); }
.paywall-note a:hover { text-decoration: underline; }

/* --- unlock page --------------------------------------------------------- */

.purchase { padding: 26px 36px 40px; font-family: var(--font-sans); font-size: 14.5px; line-height: 1.8; }
.purchase-price { margin: 0 0 18px; color: var(--text-muted); }
.purchase-price strong { margin-left: 6px; color: var(--text); font-size: 22px; }
.purchase-status { margin: 20px 0 0; color: var(--text-muted); }

.unlock { padding: 26px 36px 40px; font-family: var(--font-sans); font-size: 14.5px; }
.unlock-error {
  margin: 0 0 20px;
  padding: 12px 16px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--text);
}
.unlock-instructions { margin-bottom: 22px; line-height: 1.8; color: var(--text-muted); }
.unlock-instructions a { color: var(--accent); }

.unlock-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.unlock-label { flex: 100%; font-size: 12px; color: var(--text-faint); }
.unlock-input {
  flex: 1 1 240px;
  padding: 10px 14px;
  border: 1px solid var(--divider);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
}
.unlock-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.unlock-submit {
  padding: 10px 24px;
  border: 0;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}
.unlock-submit:hover { opacity: 0.88; }
.unlock-note { margin: 20px 0 0; font-size: 13px; color: var(--text-faint); }

/* --- tip / 打赏 ---------------------------------------------------------- */

.tip {
  margin: 8px 36px 28px;
  padding: 22px 20px 20px;
  border: 1px solid var(--divider);
  border-radius: 8px;
  background: var(--surface-alt);
  text-align: center;
  font-family: var(--font-sans);
}
.tip-rule {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  text-transform: none;
}
.tip-rule::before,
.tip-rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--divider);
}
.tip-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-strong);
  -webkit-text-stroke: 0.3px currentColor;
}
.tip-text {
  margin: 0 auto 16px;
  max-width: 32em;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-muted);
}
.tip-qr {
  margin: 0;
}
.tip-qr img {
  display: block;
  width: min(214px, 56vw);
  height: auto;
  margin: 0 auto;
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow);
}
.tip-qr figcaption {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--text-faint);
}

/* --- prev / next --------------------------------------------------------- */

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--column-width);
  margin: 0 auto;
  padding: 24px 30px 60px;
  font-family: var(--font-sans);
}
.post-nav-link { display: flex; flex-direction: column; gap: 4px; max-width: 46%; }
.post-nav-next { text-align: right; margin-left: auto; }
.post-nav-label { font-size: 12px; color: var(--text-faint); }
.post-nav-title { font-size: 14px; color: var(--text-muted); }
.post-nav-link:hover .post-nav-title { color: var(--accent); }

.notfound-actions { display: flex; gap: 12px; padding: 30px 36px 40px; font-family: var(--font-sans); font-size: 14px; }

/* --- single-column layout ------------------------------------------------ */

@media (max-width: 1279px) {
  .post-toc-rail { display: none; }
  .post-toc-mobile { display: block; }
}

@media (max-width: 1023px) {
  .sidebar,
  .rail { display: none; }

  .stream { margin: 0; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 56px;
    padding: 0 8px;
    background: var(--bg);
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
  }
  .topbar.is-stuck { border-bottom-color: var(--divider); }

  .icon-button {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
  }
  .icon-button:hover { color: var(--text); background: var(--surface-alt); }

  .topbar-brand {
    display: flex;
    width: 118px;
    color: var(--text-strong);
    opacity: 0;
    transition: opacity 0.2s ease;
  }
  .topbar.is-stuck .topbar-brand { opacity: 1; }

  .drawer {
    position: sticky;
    top: 56px;
    z-index: 19;
    display: flex;
    flex-direction: column;
    padding: 6px 0 12px;
    background: var(--bg);
    border-bottom: 1px solid var(--divider);
    font-family: var(--font-sans);
  }
  .drawer[hidden] { display: none; }
  .drawer-link { padding: 12px 20px; font-size: 16px; color: var(--text-muted); }
  .drawer-link.is-active { color: var(--text); background: var(--surface-alt); }

  .mobile-head { display: block; padding: 30px 20px 24px; text-align: center; }
  .mobile-head-title {
    display: flex;
    justify-content: center;
    color: var(--text-strong);
    line-height: 0;
  }
  .mobile-head-title .site-wordmark { width: 210px; }
  .mobile-head-subtitle { margin-top: 6px; font-family: var(--font-sans); font-size: 15px; color: var(--text-muted); }

  .card {
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 8px 0 40px;
    box-shadow: none;
  }

  .post-item { margin: 0 16px; }
  .post-item-link { padding: 22px 0; gap: 14px; }
  .post-item-title { font-size: 24px; }
  .post-item-thumb { width: clamp(84px, 28%, 120px); }

  .page-head,
  .post-head { padding: 22px 20px 18px; }
  .page-title,
  .post-title { font-size: 26px; }

  .post-body { padding: 20px 20px 10px; }
  .post-body pre { border-radius: 0; margin-left: -20px; margin-right: -20px; padding: 16px 20px; }
  .post-toc-mobile { margin: 0 20px 8px; }

  .paywall { margin: 0 20px 10px; }
  .tip { margin: 8px 20px 24px; padding: 18px 14px 16px; }
  .purchase { padding: 20px; }
  .unlock { padding: 20px; }
  .archive-year { padding: 4px 20px 16px; }
  .archive-list { padding: 0 20px; }
  .term-cloud { padding: 20px; }
  .pager,
  .post-nav { padding: 20px; }
}

@media (max-width: 1279px) and (min-width: 1024px) {
  /* Give the reading column the room the rail would otherwise take. */
  :root { --sidebar-width: 260px; --rail-width: 80px; }
  .rail { align-items: center; padding-right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; }
}
