/* ============================================================
   xHalo.co · 一日深读 — 「暗房 DARKROOM」主题
   设计概念：把网站当作一间暗房。读者推门进入近乎全黑的
   房间，只有安全灯的红光。配图是尚未显影的底片——悬停
   即显影。所有结构性文字说等宽字体（mono），正文保持
   衬线以供长读；中西文混排即装饰。
   浅色主题为「明室」（安全灯关闭的白房间），同一套 token
   反转。行为契约：所有类名 / ID 与旧版一致，不碰 js。
   ============================================================ */

/* ---------- 主题变量 ---------- */
:root {
  --mono:
    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", "Noto Sans Mono", monospace;
  --serif:
    "Noto Serif SC", "Noto Serif TC", "Noto Serif JP", "Noto Serif KR",
    "Songti SC", "STSong", "SimSun",
    Georgia, "Times New Roman", serif;

  /* 明室：白房间 */
  --bg:        #f1eee6;
  --bg-2:      #e7e2d4;
  --bg-3:      #faf8f1;
  --ink:       #131210;   /* 正文 */
  --ink-2:     #4d4a44;   /* 次级 */
  --ink-3:     #6b655a;   /* 弱化 5.0:1 */
  --red:       #c22a12;   /* 安全灯红（浅底） */
  --red-deep:  #8f1e0c;
  --red-wash:  rgba(194, 42, 18, 0.08);
  --line:      #d6d0bf;
  --line-strong:#b3ab97;
  --hole:      #d9d3c2;   /* 胶片齿孔 */
  --grain-op:  0.05;
  --sel-ink:   #f7f4ec;
  color-scheme: light;
}

:root[data-theme="dark"] {
  /* 暗房：安全灯亮起 */
  --bg:        #060607;
  --bg-2:      #0d0d0f;
  --bg-3:      #141416;
  --ink:       #ece7da;
  --ink-2:     #aaa496;
  --ink-3:     #7f7a6e;   /* 弱化 4.7:1 */
  --red:       #ff3b1f;
  --red-deep:  #d12f16;
  --red-wash:  rgba(255, 59, 31, 0.09);
  --line:      #232327;
  --line-strong:#3c3c44;
  --hole:      #1c1c20;
  --grain-op:  0.08;
  --sel-ink:   #0a0a0a;
  color-scheme: dark;
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.9;
  letter-spacing: 0.01em;
  transition: background-color 0.35s ease, color 0.35s ease;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

html[lang="ja"] body {
  font-family: "Noto Serif JP", "Noto Serif SC", "Hiragino Mincho ProN", Georgia, serif;
}
html[lang="ko"] body {
  font-family: "Noto Serif KR", "Noto Serif SC", "Batang", Georgia, serif;
}
html[lang="en"] body {
  font-family: Georgia, "Times New Roman", serif;
}

/* 胶片颗粒：整站罩一层极淡的噪点 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: var(--grain-op);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection {
  background: var(--red);
  color: var(--sel-ink);
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
  border-radius: 1px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-strong); border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--red); }

/* ---------- 布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 43rem) 232px;
  gap: 3.2rem;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 2rem 5rem;
  align-items: start;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 300;
  background: var(--red);
  color: var(--sel-ink);
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 0.6rem 1rem;
}
.skip:focus { left: 0; }

/* 汉堡按钮（移动端） */
#menu-btn {
  display: none;
}

/* 桌面：卷首通栏——暗房门口的全幅片头，三栏在下方展开 */
@media (min-width: 1025px) {
  .layout { grid-template-rows: auto auto; }
  .content { display: contents; }
  .article-head {
    grid-column: 1 / -1;
    grid-row: 1;
    padding: 9vh 0 7vh;
    margin-bottom: 4rem;
    text-align: center;
  }
  .article-head .kicker { justify-content: center; }
  .article-head h1 { font-size: clamp(2.8rem, 7vw, 5.2rem); }
  .sidebar  { grid-column: 1; grid-row: 2; }
  .article  { grid-column: 2; grid-row: 2; min-width: 0; }
  .rightcol { grid-column: 3; grid-row: 2; }
}

/* ---------- 侧栏：控制台 ---------- */
.sidebar {
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
  padding: 2.6rem 0 2rem;
  font-family: var(--mono);
  scrollbar-width: thin;
}

.brand { margin-bottom: 2.4rem; }
.brand-link {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
  color: inherit;
}
.avatar {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border: 1px solid var(--line-strong);
  transition: filter 0.7s ease, border-color 0.25s ease;
}
/* 暗房里：底片——未显影的头像，悬停显影；明室里直接是常态 */
:root[data-theme="dark"] .avatar {
  filter: invert(0.92) hue-rotate(184deg) saturate(0.7) brightness(0.98);
}
.brand-link:hover .avatar,
.brand-link:focus-visible .avatar { filter: none; border-color: var(--red); }
.brand h1 {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.brand h1::after {
  content: " ●";
  color: var(--red);
  font-size: 0.7em;
}
.tagline {
  margin: 0.7rem 0 0;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--ink-3);
}

/* 区块编号：控制台式 */
.side-block {
  counter-increment: panel;
  margin: 0 0 1.8rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}
.sidebar { counter-reset: panel; }
.side-block > h2 {
  margin: 0 0 0.9rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  color: var(--ink-3);
}
.side-block > h2::before {
  content: counter(panel, decimal-leading-zero) " / ";
  color: var(--red);
}

.archive-list { list-style: none; margin: 0; padding: 0; }
.archive-list a {
  display: block;
  padding: 0.55rem 0;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px dotted var(--line);
  transition: padding-left 0.25s ease;
}
.archive-list a:hover { padding-left: 0.5rem; }
.archive-list time {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--red);
}
.archive-list .post-title {
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  color: var(--ink);
}
.archive-list a:hover .post-title { color: var(--red); }
.badge {
  display: inline-block;
  margin-left: 0.5em;
  padding: 0.1em 0.55em;
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  color: var(--red);
  border: 1px solid var(--red);
  vertical-align: 0.1em;
}

.home-link {
  display: block;
  margin: 0 0 0.7rem;
  padding: 0.6rem 0.9rem;
  font-size: 0.8rem;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  text-decoration: none;
  color: var(--ink-2);
  border: 1px solid var(--line);
  transition: border-color 0.25s ease, color 0.25s ease;
}
.home-link:hover { border-color: var(--red); color: var(--red); }
.home-link::before { content: "> "; color: var(--red); }

.side-controls {
  margin-top: 1.8rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.9rem;
}
.side-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  color: var(--ink-3);
  margin-bottom: 0.4rem;
}
#lang-select {
  width: 100%;
  font: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--ink);
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  padding: 0.55rem 0.7rem;
  cursor: pointer;
}
#theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line);
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  transition: border-color 0.25s ease, color 0.25s ease;
}
#theme-toggle:hover { border-color: var(--red); color: var(--red); }
#theme-toggle .icon { color: var(--red); }

.side-close { display: none; }

/* ---------- 卷首 ---------- */
.content { grid-column: 2; min-width: 0; }

.article-head {
  padding: 3.2rem 0 2.8rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2.6rem;
}
.kicker {
  margin: 0 0 1.6rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.kicker::before,
.kicker::after {
  content: "";
  height: 1px;
  width: 3.2rem;
  background: var(--red);
  flex: none;
}

.article-head h1 {
  margin: 0 0 1.1rem;
  font-family: var(--mono);
  font-size: clamp(2.1rem, 4.6vw + 1rem, 3.6rem);
  font-weight: 800;
  line-height: 1.28;
  letter-spacing: 0.02em;
  text-wrap: balance;
}
.subtitle {
  margin: 0 0 1.6rem;
  font-size: 1.08rem;
  color: var(--ink-2);
  letter-spacing: 0.04em;
}
.dateline {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.22em;
  color: var(--red);
}
/* 印章：安全灯下的红印 */
.seal {
  display: inline-block;
  margin-top: 1.8rem;
  padding: 0.35em 0.5em;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--red);
  border: 2px solid var(--red);
  transform: rotate(-4deg);
  transition: transform 0.3s ease;
}
.seal:hover { transform: rotate(0deg) translateY(-2px); }

/* ---------- 正文 ---------- */
.article { counter-reset: sec frame; }
.article > p { margin: 0 0 1.7rem; }

.article h2 {
  counter-increment: sec;
  margin: 3.4rem 0 1.4rem;
  font-family: var(--mono);
  font-size: 1.42rem;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.03em;
}
.article h2::before {
  content: counter(sec, decimal-leading-zero);
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.34em;
  color: var(--red);
}
.article h2 .h-anchor {
  margin-left: 0.6em;
  font-size: 0.7em;
  color: var(--ink-3);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.article h2:hover .h-anchor,
.article h2:focus-within .h-anchor { opacity: 1; }
.article h2 .h-anchor:hover { color: var(--red); }

.article ul, .article ol { margin: 0 0 1.7rem; padding-left: 1.4rem; }
.article li { margin-bottom: 0.55rem; }
.article li::marker { color: var(--red); font-family: var(--mono); }

.article a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.article a:hover {
  color: var(--red);
  text-decoration-color: var(--red);
}

.article strong { color: var(--ink); }
.article em { color: var(--ink-2); }

.article code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 0.12em 0.45em;
  letter-spacing: 0;
}
.article pre {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.7;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-left: 2px solid var(--red);
  padding: 1.1rem 1.3rem;
  overflow-x: auto;
  margin: 0 0 1.7rem;
}
.article pre code { background: none; border: 0; padding: 0; }

.article hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 3rem 0;
  position: relative;
}
.article hr::after {
  content: "···";
  position: absolute;
  top: -0.85em;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 1em;
  background: var(--bg);
  color: var(--red);
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
}

/* 卷首语 */
.epigraph {
  margin: 0 0 2.6rem;
  padding: 0.4rem 0 0.4rem 1.4rem;
  border-left: 2px solid var(--red);
  color: var(--ink-2);
  font-size: 1rem;
}
.epigraph strong { color: var(--red); font-family: var(--mono); font-size: 0.86em; letter-spacing: 0.1em; }

/* ---------- 配图：底片 ---------- */
.article figure {
  counter-increment: frame;
  margin: 3rem 0;
  padding: 2.6rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  /* 胶片齿孔 */
  background-image:
    radial-gradient(circle, var(--hole) 5px, transparent 5.5px),
    radial-gradient(circle, var(--hole) 5px, transparent 5.5px);
  background-size: 32px 22px;
  background-position: top center, bottom center;
  background-repeat: repeat-x;
}
.article figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line-strong);
  transition: filter 0.8s ease;
}
/* 暗房里：未显影的底片；悬停 / 聚焦即显影。明室里是常态。 */
:root[data-theme="dark"] .article figure img {
  filter: invert(0.92) hue-rotate(184deg) saturate(0.7) brightness(0.98);
}
:root[data-theme="dark"] .article figure:hover img,
:root[data-theme="dark"] .article figure:focus-within img {
  filter: none;
}
.article figcaption {
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--ink-3);
}
.article figcaption::before {
  content: "FR-" counter(frame, decimal-leading-zero) " ▸ ";
  color: var(--red);
}

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; margin: 0 0 2.2rem; }
.article table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.65;
}
.article thead th {
  text-align: left;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--red);
  padding: 0.7rem 0.9rem;
  border-top: 2px solid var(--red);
  border-bottom: 1px solid var(--red);
  white-space: nowrap;
}
.article tbody td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  vertical-align: top;
}
.article tbody tr:last-child td { border-bottom: 2px solid var(--line-strong); }
.article tbody tr:hover td { color: var(--ink); background: var(--red-wash); }

/* ---------- 右栏：目录 ---------- */
.rightcol {
  grid-column: 3;
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
  padding: 2.6rem 0 2rem;
  font-family: var(--mono);
  scrollbar-width: thin;
}

.toc { margin: 0 0 1.6rem; }
.toc summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.9rem;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--ink-2);
  border: 1px solid var(--line-strong);
  transition: border-color 0.25s ease, color 0.25s ease;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary:hover { border-color: var(--red); color: var(--red); }
.toc .chev { color: var(--red); transition: transform 0.25s ease; }
.toc[open] .chev { transform: rotate(180deg); }
.toc-heading { display: none; }

#toc-list {
  list-style: none;
  counter-reset: toc;
  margin: 1rem 0 0;
  padding: 0;
}
#toc-list li { counter-increment: toc; margin: 0; }
#toc-list a {
  display: flex;
  gap: 0.8em;
  padding: 0.5rem 0;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  line-height: 1.6;
  color: var(--ink-3);
  text-decoration: none;
  border-bottom: 1px dotted var(--line);
  transition: color 0.2s ease, padding-left 0.25s ease;
}
#toc-list a::before {
  content: counter(toc, decimal-leading-zero);
  flex: none;
  color: var(--red);
  opacity: 0.75;
}
#toc-list a:hover { color: var(--red); padding-left: 0.4rem; }
#toc-list a.active { color: var(--ink); }
#toc-list a.active::before { opacity: 1; }

/* 回到顶部 */
#to-top {
  font: inherit;
  font-family: var(--mono);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  width: 100%;
  padding: 0.7rem 1rem;
  font-size: 0.74rem;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line-strong);
  cursor: pointer;
  transition: border-color 0.25s ease, color 0.25s ease, transform 0.12s ease;
}
#to-top:hover { border-color: var(--red); color: var(--red); }
#to-top:active { transform: translateY(1px); }
#to-top .to-top-icon { color: var(--red); }

/* ---------- 页脚 ---------- */
.footer {
  border-top: 1px solid var(--line);
  margin-top: 1rem;
  padding: 2.2rem 2rem 2.6rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--ink-3);
}
.footer p { margin: 0.5rem 0; }
.footer a {
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px dotted var(--line-strong);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.footer a:hover { color: var(--red); border-bottom-color: var(--red); }

/* ---------- 404 ---------- */
.nf-wrap {
  max-width: 43rem;
  margin: 0 auto;
  padding: 15vh 1.5rem 13vh;
  text-align: center;
}
.nf-code {
  margin: 0 0 1.6rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  color: var(--red);
}
.nf-wrap h1 {
  margin: 0 0 1.2rem;
  font-family: var(--mono);
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-wrap: balance;
}
.nf-wrap p { color: var(--ink-2); }
.nf-wrap p a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 4px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.nf-wrap p a:hover { color: var(--red); text-decoration-color: var(--red); }
.nf-wrap .seal { margin-top: 2.4rem; }

/* ---------- 抽屉 / 遮罩（移动端，行为与旧版一致） ---------- */
#scrim {
  position: fixed;
  inset: 0;
  z-index: 115;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
body.nav-open #scrim { opacity: 1; pointer-events: auto; }
body.nav-open { overflow: hidden; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .layout {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 1.4rem 1.25rem 4rem;
    max-width: 720px;
    align-items: stretch;   /* 窄屏/大字号下条目拉伸而非按内容撑宽 */
  }
  .content { order: 0; }

  /* 左栏变抽屉 */
  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 120;
    width: min(320px, 86vw);
    max-height: none;
    padding: 1.6rem 1.4rem 2rem;
    background: var(--bg-2);
    border-right: 1px solid var(--line-strong);
    transform: translateX(-105%);
    transition: transform 0.32s ease;
    overflow-y: auto;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .side-close {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0.9rem; right: 0.9rem;
    width: 44px; height: 44px;
    font-size: 1rem;
    color: var(--ink-2);
    background: transparent;
    border: 1px solid var(--line);
    cursor: pointer;
  }
  .side-close:hover { color: var(--red); border-color: var(--red); }

  #menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    left: 1.1rem; bottom: 1.3rem;
    z-index: 110;
    width: 3.2rem; height: 3.2rem;
    border-radius: 50%;
    font-size: 1.25rem;
    color: var(--ink);
    background: var(--bg-2);
    border: 1px solid var(--red);
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  }

  /* 右栏：折叠目录置顶 */
  .rightcol {
    order: -1;
    position: static;
    max-height: none;
    overflow: visible;
    padding: 0 0 0.4rem;
  }
  .toc {
    margin: 0;
    border: 1px solid var(--line-strong);
    background: var(--bg-2);
  }
  .toc summary { border: 0; }
  #toc-list { padding: 0 0.9rem 0.6rem; }

  /* 移动端回到顶部：悬浮 */
  #to-top {
    position: fixed;
    right: 1.1rem; bottom: 1.3rem;
    z-index: 110;
    width: 3.2rem; height: 3.2rem;
    padding: 0;
    border-radius: 50%;
    background: var(--bg-2);
    border: 1px solid var(--red);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
  }
  #to-top.visible { opacity: 1; pointer-events: auto; transform: none; }
  #to-top .to-top-label { display: none; }
  #to-top .to-top-icon { margin: 0; }

  .article-head { padding: 1.6rem 0 2.2rem; }
}

@media (max-width: 640px) {
  .article-head h1 { font-size: clamp(1.7rem, 8.5vw, 2.3rem); }
  .kicker { display: block; letter-spacing: 0.2em; text-indent: 0.2em; }
  .kicker::before, .kicker::after { display: none; }
  .dateline { letter-spacing: 0.16em; text-indent: 0.16em; }
  .article figure { padding: 2rem 0; }
  .seal { font-size: 0.95rem; }
}

/* 触屏无悬停：直接呈现显影后状态（底片概念只在可悬停设备上成立） */
@media (hover: none) {
  :root[data-theme="dark"] .article figure img,
  :root[data-theme="dark"] .avatar { filter: none; }
}

/* ---------- 动效与可访问性 ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes grain-shift {
  0%, 100% { transform: translate(0, 0); }
  25%      { transform: translate(-1.5%, 2%); }
  50%      { transform: translate(2%, -1.5%); }
  75%      { transform: translate(-2%, -2%); }
}

/* 颗粒微颤：暗房里的空气 */
body::after {
  animation: grain-shift 1.8s steps(3) infinite;
}

/* 卷首 stagger 入场 */
.article-head > * { animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both; }
.article-head > *:nth-child(2) { animation-delay: 0.07s; }
.article-head > *:nth-child(3) { animation-delay: 0.14s; }
.article-head > *:nth-child(4) { animation-delay: 0.21s; }
.article-head > *:nth-child(5) { animation-delay: 0.28s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  /* 减弱动效时直接呈现显影后状态，避免 filter 成为阅读障碍 */
  :root .article figure img,
  :root .avatar,
  :root[data-theme="dark"] .article figure img,
  :root[data-theme="dark"] .avatar { filter: none; }
  body::after { display: none; }
}
