/* ============================================================
   Brucebat · 闲宇非鱼 — 极简编辑风
   一册干净的中文专栏：纸白底 / 宋体大标题 / 细线分章 / 大量留白
   浅色 = 纸白墨字；深色 = 暖墨黑
   单一事实来源：:root 与 [data-theme="dark"] 的变量
   ============================================================ */

/* ---------- 1. Tokens ---------- */
:root {
  --bg: #fafaf8;
  --text: #262624;
  --muted: #6e6c66;
  --line: #e7e5de;
  --line-strong: #d6d4cc;
  --accent: #31614f;      /* 松绿：编号 / 链接 / 状态 */
  --accent-2: #b5442f;    /* 朱砂：着重号 / 句点 / 悬停箭头 */

  --font-serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC",
    "STSong", "SimSun", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas,
    monospace;

  --wrap: 720px;
  --speed: 0.22s;
}

[data-theme="dark"] {
  --bg: #151412;
  --text: #e6e3db;
  --muted: #98958c;
  --line: #2a2925;
  --line-strong: #3c3a34;
  --accent: #8fb8a5;
  --accent-2: #d97b62;
}

/* ---------- 2. Reset / 基础 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.85 var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1,
h2,
h3,
p,
dl,
dd,
dt,
ul,
figure {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

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

.mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

::selection {
  background: rgba(49, 97, 79, 0.16);
}

[data-theme="dark"] ::selection {
  background: rgba(143, 184, 165, 0.24);
}

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

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 99;
  padding: 8px 14px;
  background: var(--text);
  color: var(--bg);
  border-radius: 0 0 8px 8px;
  transition: top var(--speed) ease;
}

.skip:focus {
  top: 0;
}

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 32px);
}

/* ---------- 3. Header ---------- */
.hdr {
  border-bottom: 1px solid var(--line);
}

.hdr__inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
}

.brand__mark {
  width: 26px;
  height: 26px;
  border-radius: 50%;
}

.brand__name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.02em;
}

.hdr__nav {
  display: flex;
  gap: 22px;
}

.hdr__nav a {
  font-size: 14px;
  color: var(--muted);
  transition: color var(--speed) ease;
}

.hdr__nav a:hover {
  color: var(--accent);
}

.theme-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--speed) ease, border-color var(--speed) ease;
}

.theme-btn:hover {
  color: var(--accent);
  border-color: var(--line-strong);
}

[data-theme="light"] .theme-btn__sun {
  display: none;
}

[data-theme="dark"] .theme-btn__moon {
  display: none;
}

/* ---------- 4. Hero ---------- */
.hero {
  position: relative;
  padding-block: clamp(72px, 14vh, 136px) clamp(56px, 9vh, 96px);
}

.eyebrow {
  color: var(--accent);
}

.hero__title {
  margin-top: 22px;
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: clamp(40px, 8.5vw, 84px);
  line-height: 1.24;
  letter-spacing: 0.02em;
  color: var(--text);
}

/* 「有意思的」朱砂色：标题的记忆点 */
.hero__title .em {
  color: var(--accent-2);
}

.hero__title .dot {
  color: var(--accent-2);
}

.hero__lede {
  margin-top: clamp(24px, 4vh, 36px);
  font-size: 16.5px;
  color: var(--muted);
  max-width: 34em;
}

.now {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 26px;
  font-size: 13.5px;
  color: var(--muted);
}

.now .mono {
  color: var(--accent);
}

.now__dot {
  position: relative;
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.now__dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.5);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

/* 右缘竖排署名 + 朱砂小印（桌面装饰） */
.hero__side {
  position: absolute;
  top: clamp(72px, 14vh, 120px);
  right: clamp(20px, 6vw, 64px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.hero__vertical {
  writing-mode: vertical-rl;
  font-family: var(--font-serif);
  font-size: 15px;
  letter-spacing: 0.52em;
  color: var(--muted);
  padding-right: 0.26em;
}

.hero__seal {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 3px;
  background: var(--accent-2);
  color: var(--bg);
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 900px) {
  .hero__side {
    display: none;
  }
}

/* ---------- 5. 章节 ---------- */
.sect {
  margin-top: clamp(48px, 8vh, 88px);
}

.sect__head {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.sect__num {
  color: var(--accent);
}

.sect__title {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: clamp(24px, 4vw, 32px);
  letter-spacing: 0.06em;
}

.sect__line {
  flex: 1;
  height: 1px;
  background: var(--line);
  align-self: center;
}

/* ---------- 6. 关于：事实清单 ---------- */
.facts {
  margin-top: 26px;
}

.facts__row {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 18px;
  padding-block: 18px;
  border-top: 1px solid var(--line);
}

.facts__row:last-child {
  border-bottom: 1px solid var(--line);
}

.facts__term {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
}

.facts__desc {
  font-size: 15px;
  color: var(--muted);
}

@media (max-width: 620px) {
  .facts__row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* ---------- 7. 作品：编辑列表行 ---------- */
.works {
  margin-top: 10px;
}

.works__row {
  display: block;
  padding-block: 26px;
  border-top: 1px solid var(--line);
}

.works li:last-child .works__row {
  border-bottom: 1px solid var(--line);
}

.works__name {
  display: inline-block;
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: clamp(22px, 3.6vw, 28px);
  letter-spacing: 0.03em;
  transition: color var(--speed) ease;
}

.works__row:hover .works__name {
  color: var(--accent);
}

.works__desc {
  display: block;
  margin-top: 8px;
  font-size: 15px;
  color: var(--muted);
  max-width: 40em;
}

.works__meta {
  display: block;
  margin-top: 14px;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0.1em;
}

.arrow {
  display: inline-block;
  color: var(--accent-2);
  transition: transform var(--speed) ease;
}

.works__row:hover .arrow,
.bili:hover .arrow {
  transform: translate(3px, -3px);
}

/* ---------- 8. 联系 ---------- */
.contact {
  margin-top: 30px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(28px, 5vw, 48px);
}

.contact__label {
  color: var(--accent);
}

.contact__name {
  margin-top: 10px;
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: 21px;
  letter-spacing: 0.03em;
}

.contact__desc {
  margin-top: 10px;
  font-size: 14.5px;
  color: var(--muted);
}

.contact__desc b {
  color: var(--text);
  font-weight: 600;
}

.qr {
  margin-top: 18px;
  max-width: 400px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.qr img {
  width: 100%;
}

.bili {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 10px 16px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: border-color var(--speed) ease;
}

.bili:hover {
  border-color: var(--line-strong);
}

.bili__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.bili__url {
  letter-spacing: 0.06em;
  text-transform: none;
  color: var(--text);
}

.bili .arrow {
  color: var(--accent-2);
}

@media (max-width: 760px) {
  .contact {
    grid-template-columns: 1fr;
  }
}

/* ---------- 9. Footer ---------- */
.ftr {
  margin-top: clamp(64px, 10vh, 110px);
  border-top: 1px solid var(--line);
  padding-block: 30px 44px;
}

.ftr__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.ftr__slogan {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.05em;
}

.ftr__dot {
  color: var(--accent-2);
}

.ftr__meta {
  font-size: 11px;
  color: var(--muted);
}

.ftr__meta a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
}

.ftr__meta a:hover {
  color: var(--text);
}

/* ---------- 10. 入场 reveal（仅在 JS 可用时隐藏待入场） ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  transition-delay: calc(var(--d, 0) * 70ms);
}

.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

/* 打印 / 存 PDF 时内容必须全部可见 */
@media print {
  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- 11. 减弱动态 ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .now__dot::after {
    animation: none;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .arrow {
    transition: none;
  }
}
