/* xblack 个人主页 —— 前台样式
   暖调象牙白底、深灰文字、陶土橙点缀，标题用衬线体。 */

/* 只给拉丁字符用的衬线字体（SIL OFL，自托管）。
   unicode-range 故意不含弯引号、破折号、省略号，让它们在中文标题里仍然走中文字体的全角字形。 */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('../fonts/source-serif-4-latin.woff2') format('woff2');
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2010-2013, U+20AC, U+2122, U+2212;
}

:root {
  --bg: #faf9f5;
  --bg-sunk: #f0eee6;
  --surface: #ffffff;
  --line: #e8e6dc;
  --line-strong: #d1cfc5;
  --text: #141413;
  --text-2: #3d3d3a;
  --text-3: #73726c;
  --accent: #d97757;
  --accent-strong: #c6613f;
  --accent-ink: #ad4e2b;
  --accent-wash: #f6e7df;
  --ok: #5c7341;

  /* 文章里的文字颜色（后台「颜色」按钮）。浅色、深色各一套，对比度都在 4.5:1 以上 */
  --tc-red: #c92a2a;
  --tc-orange: #b84a06;
  --tc-yellow: #8a6100;
  --tc-green: #2a7a3c;
  --tc-teal: #0b7285;
  --tc-blue: #1c62c4;
  --tc-purple: #7a3fc4;
  --tc-gray: #6b6a64;

  /* 文字底色（后台「底色」按钮），同样浅色、深色各一套 */
  --tb-red: #ffe0dc;
  --tb-orange: #ffe3c7;
  --tb-yellow: #fff0a6;
  --tb-green: #d8f2d4;
  --tb-teal: #cfeff0;
  --tb-blue: #dae8ff;
  --tb-purple: #eadfff;
  --tb-gray: #e8e6dc;

  --code-bg: #1f1e1d;
  --code-head: #262624;
  --code-line: #1f1e1d;
  --code-text: #edebe3;

  --shadow-box: 0 4px 20px rgba(20, 20, 19, 0.045), 0 1px 2px rgba(20, 20, 19, 0.04);
  --shadow-box-focus: 0 6px 28px rgba(20, 20, 19, 0.08), 0 1px 2px rgba(20, 20, 19, 0.05);

  --serif: 'Source Serif 4', 'Songti SC', 'Noto Serif CJK SC', 'Source Han Serif SC', 'Source Han Serif CN', STSong, SimSun, Georgia, serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', 'Cascadia Code', Menlo, Consolas, 'Liberation Mono', monospace;

  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg: #1f1e1d;
  --bg-sunk: #292826;
  --surface: #2c2b29;
  --line: #383734;
  --line-strong: #4f4d49;
  --text: #f5f4ed;
  --text-2: #d6d4ca;
  --text-3: #a09e95;
  --accent: #d97757;
  --accent-strong: #e38b6d;
  --accent-ink: #e9a083;
  --accent-wash: #3a2a23;
  --ok: #a8bf8b;

  --tc-red: #ff8787;
  --tc-orange: #ffa94d;
  --tc-yellow: #f5c542;
  --tc-green: #8ce99a;
  --tc-teal: #66d9e8;
  --tc-blue: #74c0fc;
  --tc-purple: #c8a6f7;
  --tc-gray: #a6a49b;

  --tb-red: #5a2a27;
  --tb-orange: #56381d;
  --tb-yellow: #4f4318;
  --tb-green: #25472b;
  --tb-teal: #1c4649;
  --tb-blue: #253d63;
  --tb-purple: #413068;
  --tb-gray: #45433f;

  --code-bg: #171716;
  --code-head: #1c1b1a;
  --code-line: #33322f;

  --shadow-box: 0 4px 20px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-box-focus: 0 6px 28px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.25);

  color-scheme: dark;
}

/* 没有 JS 时退回到跟随系统 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #1f1e1d;
    --bg-sunk: #292826;
    --surface: #2c2b29;
    --line: #383734;
    --line-strong: #4f4d49;
    --text: #f5f4ed;
    --text-2: #d6d4ca;
    --text-3: #a09e95;
    --accent-strong: #e38b6d;
    --accent-ink: #e9a083;
    --accent-wash: #3a2a23;
    --ok: #a8bf8b;
    --tc-red: #ff8787;
    --tc-orange: #ffa94d;
    --tc-yellow: #f5c542;
    --tc-green: #8ce99a;
    --tc-teal: #66d9e8;
    --tc-blue: #74c0fc;
    --tc-purple: #c8a6f7;
    --tc-gray: #a6a49b;
    --tb-red: #5a2a27;
    --tb-orange: #56381d;
    --tb-yellow: #4f4318;
    --tb-green: #25472b;
    --tb-teal: #1c4649;
    --tb-blue: #253d63;
    --tb-purple: #413068;
    --tb-gray: #45433f;
    --code-bg: #171716;
    --code-head: #1c1b1a;
    --code-line: #33322f;
    color-scheme: dark;
  }
}

/* ---------- 基础 ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  flex: 1;
}

img,
svg,
video {
  max-width: 100%;
}

svg {
  flex: none;
}

a {
  color: inherit;
}

h1,
h2,
h3,
h4,
p {
  overflow-wrap: break-word;
}

::selection {
  background: rgba(217, 119, 87, 0.28);
}

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

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.wrap {
  width: 100%;
  max-width: 1208px;
  margin: 0 auto;
  padding: 0 24px;
}

.wrap-narrow {
  max-width: 808px;
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: 500 0.95rem/1 var(--sans);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.btn-primary {
  background: var(--text);
  color: var(--bg);
}

.btn-primary:hover {
  background: var(--text-2);
}

.btn-outline {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--text);
}

.btn-outline:hover {
  background: var(--bg-sunk);
}

.btn-quiet {
  background: transparent;
  color: var(--text-2);
}

.btn-quiet:hover {
  background: var(--bg-sunk);
  color: var(--text);
}

.btn-small {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- 导航 ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.nav.is-scrolled {
  border-bottom-color: var(--line);
}

.nav-in {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-links a {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--text-2);
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}

.nav-links a:hover {
  background: var(--bg-sunk);
  color: var(--text);
}

.nav-links a[aria-current] {
  color: var(--text);
  font-weight: 500;
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-left: 4px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.theme-toggle:hover {
  background: var(--bg-sunk);
  color: var(--text);
}

.theme-toggle span {
  display: grid;
}

.icon-sun,
:root[data-theme='dark'] .icon-moon {
  display: none !important;
}

:root[data-theme='dark'] .icon-sun {
  display: grid !important;
}

/* ---------- 首页：开场 ---------- */

.hero {
  padding: clamp(48px, 9vh, 104px) 0 clamp(32px, 5vh, 56px);
  text-align: center;
}

.hero-avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--line-strong), 0 6px 20px rgba(20, 20, 19, 0.08);
}

.hero h1 {
  margin: 28px 0 0;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 1.5rem + 4.4vw, 4.375rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

.hero-lead {
  margin: 18px auto 0;
  max-width: 34em;
  font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.3rem);
  color: var(--text-3);
}

.ask {
  max-width: 660px;
  margin: 40px auto 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-box);
  text-align: left;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ask:focus-within {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-box-focus);
}

.ask input {
  display: block;
  width: 100%;
  padding: 18px 20px 4px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  -webkit-appearance: none;
  appearance: none;
}

.ask input::placeholder,
.search input::placeholder {
  color: var(--text-3);
  opacity: 1;
}

.ask input::-webkit-search-cancel-button,
.search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.ask-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px 10px 20px;
}

.ask-hint {
  font-size: 0.85rem;
  color: var(--text-3);
}

.ask-send {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.15s;
}

.ask-send:hover {
  background: var(--accent-strong);
}

.ask-send:active {
  transform: scale(0.95);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--text-2);
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.chip svg {
  width: 16px;
  height: 16px;
  color: var(--text-3);
  transition: color 0.15s;
}

.chip:hover {
  background: var(--bg-sunk);
  color: var(--text);
}

.chip:hover svg {
  color: var(--accent);
}

.hero-quote {
  max-width: 600px;
  min-height: 3.5em;
  margin: 40px auto 0;
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--text-3);
}

.hero-quote.is-typing .hero-quote-text::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: -0.15em;
  background: var(--accent);
  animation: caret 1s steps(1) infinite;
}

@keyframes caret {
  50% {
    opacity: 0;
  }
}

/* ---------- 区块 ---------- */

.section {
  padding: clamp(36px, 6vw, 64px) 0;
}

.section-tight {
  padding-top: 8px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 24px;
}

.section-head h2,
.about h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.375rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.section-note {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-3);
}

.more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
  color: var(--text-2);
  text-decoration: none;
}

.more svg,
.post-row-arrow svg {
  transition: transform 0.2s;
}

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

.more:hover svg {
  transform: translateX(3px);
}

.empty {
  margin: 0;
  padding: 44px 24px;
  border-radius: 16px;
  background: var(--bg-sunk);
  text-align: center;
  color: var(--text-3);
}

/* ---------- 文章列表 ---------- */

.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.post-list li {
  border-bottom: 1px solid var(--line);
}

.post-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 20px;
  gap: 24px;
  padding: 22px 4px;
  text-decoration: none;
}

.post-row time {
  padding-top: 0.32em;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}

.post-row h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.32rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.005em;
  transition: color 0.15s;
}

.post-row p {
  display: -webkit-box;
  margin: 6px 0 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  font-size: 0.95rem;
  color: var(--text-2);
}

.post-row-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.post-row-tags span {
  padding: 1px 8px;
  border-radius: 6px;
  background: var(--bg-sunk);
  font-size: 0.78rem;
  color: var(--text-3);
}

.post-row-arrow {
  padding-top: 0.3em;
  color: var(--text-3);
}

.post-row:hover h3 {
  color: var(--accent-ink);
}

.post-row:hover .post-row-arrow svg {
  transform: translateX(4px);
  color: var(--accent);
}

/* ---------- 项目 ---------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-grid li {
  display: grid;
}

.project {
  display: flex;
  flex-direction: column;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 20px;
  background: var(--bg-sunk);
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}

a.project:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.project-img {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 12px;
  background: var(--line);
}

.project-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

a.project:hover .project-img img {
  transform: scale(1.04);
}

.project-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 16px 10px 10px;
}

.project-sub {
  margin: 0 0 4px;
  overflow: hidden;
  font-size: 0.8rem;
  color: var(--text-3);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.project h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.3;
}

.project-text {
  display: -webkit-box;
  margin: 8px 0 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-2);
}

.project-go {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: auto;
  padding-top: 16px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent-ink);
}

.project-go svg {
  transition: transform 0.2s;
}

a.project:hover .project-go svg {
  transform: translate(2px, -2px);
}

/* ---------- 关于 ---------- */

.about {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(28px, 5vw, 72px);
  padding: clamp(28px, 5vw, 60px);
  border-radius: 28px;
  background: var(--bg-sunk);
}

.about-text {
  max-width: 32em;
  margin: 16px 0 0;
  font-size: 1.05rem;
  color: var(--text-2);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.tag-cloud li {
  padding: 5px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg);
  font-size: 0.9rem;
  color: var(--text-2);
}

.about-skills h3 {
  margin: 6px 0 12px;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-3);
}

.skills {
  columns: 2;
  column-gap: 44px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.skills li {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
  font-size: 0.92rem;
  break-inside: avoid;
}

.skill-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--line-strong);
}

.skill-bar span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
}

.skill-num {
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text-3);
}

/* ---------- 页脚 ---------- */

.footer {
  margin-top: clamp(40px, 6vw, 72px);
  padding: 56px 0 28px;
  background: #141413;
  color: #b0aea5;
}

.footer-top {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 40px;
}

.footer-name {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.7rem;
  line-height: 1.2;
  color: #faf9f5;
}

.footer-tagline {
  margin: 8px 0 0;
  font-size: 0.95rem;
}

.footer-col h2 {
  margin: 4px 0 12px;
  font-size: 0.82rem;
  font-weight: 500;
  color: #87867f;
}

.footer-col a {
  display: block;
  width: fit-content;
  padding: 4px 0;
  font-size: 0.95rem;
  color: #d1cfc5;
  text-decoration: none;
}

.footer a:hover {
  color: #fff;
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid #30302e;
  font-size: 0.85rem;
}

.footer-legal a {
  color: #b0aea5;
  text-decoration: none;
}

/* ---------- 文章列表页 ---------- */

.page-head {
  padding: clamp(40px, 7vw, 72px) 0 24px;
}

.page-head h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.2rem, 1.6rem + 2.6vw, 3.25rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.page-sub {
  margin: 10px 0 0;
  color: var(--text-3);
}

.page-sub a {
  color: var(--accent-ink);
}

.search {
  position: relative;
  margin-top: 28px;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 15px;
  display: grid;
  color: var(--text-3);
  transform: translateY(-50%);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 44px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search input:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.2);
}

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tag-filter a {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.875rem;
  color: var(--text-2);
  text-decoration: none;
  transition: background-color 0.15s;
}

.tag-filter a:hover {
  background: var(--bg-sunk);
}

.tag-filter small {
  font-size: 0.75rem;
  color: var(--text-3);
}

.tag-filter a[aria-current] {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.tag-filter a[aria-current] small {
  color: inherit;
  opacity: 0.7;
}

.year {
  margin: 36px 0 12px;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text-3);
}

.year:first-child {
  margin-top: 16px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 40px;
}

.pager a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-size: 0.95rem;
  text-decoration: none;
}

.pager a:hover {
  background: var(--bg-sunk);
}

.pager-now {
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}

/* ---------- 订阅页 ---------- */

.feed-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  padding: 7px 7px 7px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-box);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.feed-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.2);
}

.feed-icon {
  display: grid;
  color: var(--accent);
}

.feed-url {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 0.95rem/1 var(--mono);
  text-overflow: ellipsis;
}

.feed-url:focus {
  outline: 0;
}

.feed-copy {
  flex: none;
}

/* .btn 自己设了 display，会盖掉 hidden 属性，这里补回来 */
.feed-copy[hidden] {
  display: none;
}

.feed-copy.is-copied {
  background: var(--ok);
  color: var(--bg);
}

.feed-note {
  margin: 12px 2px 0;
  font-size: 0.875rem;
  color: var(--text-3);
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  border-top: 1px solid var(--line);
}

.steps li {
  position: relative;
  padding: 16px 4px 16px 46px;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  top: 15px;
  left: 4px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-sunk);
  font-size: 0.85rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}

/* ---------- 文章页 ---------- */

.article-head {
  padding: clamp(32px, 5vw, 56px) 0 0;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--text-3);
  text-decoration: none;
}

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

.article-head h1 {
  margin: 22px 0 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 1.4rem + 2.8vw, 3.125rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.018em;
  text-wrap: balance;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin: 20px 0 0;
  font-size: 0.9rem;
  color: var(--text-3);
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.article-tags a {
  padding: 2px 10px;
  border-radius: 6px;
  background: var(--bg-sunk);
  font-size: 0.82rem;
  color: var(--text-2);
  text-decoration: none;
}

.article-tags a:hover {
  background: var(--line);
  color: var(--text);
}

.draft-banner {
  margin: 0 0 24px;
  padding: 8px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--bg));
  border-radius: 10px;
  background: var(--accent-wash);
  font-size: 0.9rem;
  color: var(--accent-ink);
}

.article-body {
  position: relative;
  max-width: 808px;
  margin-top: 36px;
  padding-top: 32px;
}

.article-body::before {
  content: '';
  position: absolute;
  top: 0;
  right: 24px;
  left: 24px;
  border-top: 1px solid var(--line);
}

.toc {
  display: none;
}

@media (min-width: 1320px) {
  .has-toc .toc {
    display: block;
    position: absolute;
    top: 32px;
    bottom: 0;
    left: 100%;
    width: 232px;
    padding-left: 24px;
  }

  .toc > * {
    position: sticky;
  }

  .toc-title {
    top: 96px;
  }

  .toc ol {
    top: 128px;
    max-height: calc(100vh - 168px);
    overflow-y: auto;
  }
}

.toc-title {
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-3);
}

.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--line);
}

.toc a {
  display: block;
  margin-left: -1px;
  padding: 4px 0 4px 14px;
  border-left: 1px solid transparent;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}

.toc-d3 a {
  padding-left: 28px;
}

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

.toc a.is-active {
  border-left-color: var(--accent);
  color: var(--text);
}

.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 56px;
}

.article-nav-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s;
}

.article-nav-item:hover {
  border-color: var(--line-strong);
  background: var(--bg-sunk);
}

.article-nav-item span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-3);
}

.article-nav-item strong {
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 500;
  line-height: 1.4;
}

.article-nav-item.is-next {
  align-items: flex-end;
  text-align: right;
}

/* ---------- 正文排版 ---------- */

.prose {
  font-size: 1.0625rem;
  line-height: 1.85;
  color: var(--text-2);
  overflow-wrap: break-word;
}

.prose > :first-child {
  margin-top: 0;
}

.prose > :last-child {
  margin-bottom: 0;
}

.prose p {
  margin: 1.2em 0;
}

.prose h1,
.prose h2,
.prose h3 {
  font-family: var(--serif);
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
}

.prose h1 {
  margin: 2.2em 0 0.7em;
  font-size: 1.85rem;
  line-height: 1.3;
}

.prose h2 {
  margin: 2.2em 0 0.7em;
  font-size: 1.65rem;
  line-height: 1.3;
}

.prose h3 {
  margin: 1.9em 0 0.6em;
  font-size: 1.32rem;
  line-height: 1.4;
}

.prose h4,
.prose h5,
.prose h6 {
  margin: 1.7em 0 0.5em;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.h-anchor {
  margin-left: 0.4em;
  font-family: var(--sans);
  font-weight: 400;
  color: var(--text-3);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s;
}

:is(h1, h2, h3, h4, h5, h6):hover > .h-anchor,
.h-anchor:focus-visible {
  opacity: 1;
}

.prose a:not(.h-anchor) {
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent-ink) 40%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s;
}

.prose a:not(.h-anchor):hover {
  text-decoration-color: currentColor;
}

.prose strong {
  font-weight: 600;
  color: var(--text);
}

/* 文字颜色 / 大小：正文里写 [文字]{红 大} */
.tc-red { color: var(--tc-red); }
.tc-orange { color: var(--tc-orange); }
.tc-yellow { color: var(--tc-yellow); }
.tc-green { color: var(--tc-green); }
.tc-teal { color: var(--tc-teal); }
.tc-blue { color: var(--tc-blue); }
.tc-purple { color: var(--tc-purple); }
.tc-gray { color: var(--tc-gray); }

/* 加粗默认会换成正文深色，套在彩色文字里时要跟着外面的颜色走 */
.prose [class*='tc-'] strong,
.prose span[style] strong {
  color: inherit;
}

.ts-sm { font-size: 0.85em; }
.ts-lg { font-size: 1.3em; line-height: 1.5; }
.ts-xl { font-size: 1.7em; line-height: 1.35; }

/* 文字底色（荧光笔）：[文字]{黄底}。每种颜色只负责给 --tb 赋值 */
.tb-red { --tb: var(--tb-red); }
.tb-orange { --tb: var(--tb-orange); }
.tb-yellow { --tb: var(--tb-yellow); }
.tb-green { --tb: var(--tb-green); }
.tb-teal { --tb: var(--tb-teal); }
.tb-blue { --tb: var(--tb-blue); }
.tb-purple { --tb: var(--tb-purple); }
.tb-gray { --tb: var(--tb-gray); }

.prose [class^='tb-'],
.prose [class*=' tb-'] {
  padding: 0.1em 0.25em;
  border-radius: 4px;
  background-color: var(--tb);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* 下划线：[文字]{下划线} */
.tu {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}

/* 对齐：::: 居中 / ::: 居右 */
.ta-center { text-align: center; }
.ta-right { text-align: right; }
.ta-left { text-align: left; }

/* 折叠内容：::: 折叠 标题 */
.fold {
  margin: 1.6em 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.fold > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  font-weight: 500;
  color: var(--text);
  list-style: none;
  cursor: pointer;
}

.fold > summary::-webkit-details-marker {
  display: none;
}

.fold > summary::before {
  content: '';
  flex: none;
  width: 7px;
  height: 7px;
  margin: 0 3px 0 2px;
  border-right: 1.7px solid var(--text-3);
  border-bottom: 1.7px solid var(--text-3);
  transform: rotate(-45deg);
  transition: transform 0.15s;
}

.fold[open] > summary::before {
  transform: translateY(-2px) rotate(45deg);
}

.fold[open] > summary {
  border-bottom: 1px solid var(--line);
}

.fold > summary:hover {
  color: var(--accent-ink);
}

.fold-body {
  padding: 2px 16px;
}

.fold-body > :first-child {
  margin-top: 0.9em;
}

.fold-body > :last-child {
  margin-bottom: 0.9em;
}

/* 提示框：::: 提示 / 注意 / 警告 / 成功 */
.callout {
  margin: 1.6em 0;
  padding: 14px 18px;
  border-left: 3px solid var(--co);
  border-radius: 4px 12px 12px 4px;
  background: color-mix(in srgb, var(--co) 9%, var(--bg));
}

.callout-info { --co: var(--tc-blue); }
.callout-warn { --co: var(--tc-yellow); }
.callout-danger { --co: var(--tc-red); }
.callout-ok { --co: var(--tc-green); }

.prose .callout > * {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.prose .callout > :first-child {
  margin-top: 0;
}

.prose .callout > :last-child {
  margin-bottom: 0;
}

.prose .callout-title {
  font-size: 0.95em;
  font-weight: 600;
  color: var(--co);
}

/* 附件下载 */
.prose a.file-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 14px 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  font-size: 0.95em;
  line-height: 1.4;
  color: var(--text);
  text-decoration: none;
  vertical-align: middle;
  transition: border-color 0.15s, background-color 0.15s;
}

.prose a.file-link svg {
  color: var(--accent);
}

.prose a.file-link span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.prose a.file-link:hover {
  border-color: var(--accent);
  background: var(--accent-wash);
}

.prose ul,
.prose ol {
  margin: 1.2em 0;
  padding-left: 1.5em;
}

.prose li {
  margin: 0.35em 0;
}

.prose li > ul,
.prose li > ol {
  margin: 0.35em 0;
}

.prose li::marker {
  color: var(--text-3);
}

.prose li:has(> input[type='checkbox']) {
  margin-left: -1.4em;
  list-style: none;
}

.prose input[type='checkbox'] {
  width: 1em;
  height: 1em;
  margin: 0 0.5em 0 0;
  vertical-align: -0.1em;
  accent-color: var(--accent);
}

.prose blockquote {
  margin: 1.6em 0;
  padding: 0.1em 0 0.1em 1.2em;
  border-left: 3px solid var(--accent);
  color: var(--text-2);
}

.prose blockquote p {
  margin: 0.6em 0;
}

.prose hr {
  margin: 2.6em 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.prose img,
.prose video,
.prose iframe {
  max-width: 100%;
}

.prose img {
  display: block;
  height: auto;
  margin: 1.6em auto;
  border-radius: 12px;
}

/* 带图注或者指定了大小 / 位置的图片，以及视频、音乐播放器：![说明](地址 "图注"){50% 居左} */
.prose .img-box,
.prose .media {
  display: block;
  max-width: 100%;
  margin: 1.6em auto;
}

.prose .img-box {
  width: fit-content;
}

.prose .img-box img {
  margin: 0 auto;
}

/* 指定了宽度：图片撑满这个宽度（小图也会被放大到这么宽） */
.prose .img-box[style] img {
  width: 100%;
}

.prose .box-left {
  margin-left: 0;
}

.prose .box-right {
  margin-right: 0;
}

.box-cap {
  display: block;
  margin-top: 0.6em;
  font-size: 0.875em;
  line-height: 1.6;
  text-align: center;
  color: var(--text-3);
}

.prose .media iframe,
.prose .media video {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: #000;
}

.prose .media-frame iframe {
  height: auto;
  aspect-ratio: 16 / 9;
}

.prose .media video {
  max-height: 80vh;
}

.prose .media-audio,
.prose .media-music {
  width: min(100%, 480px);
}

.prose .media audio {
  display: block;
  width: 100%;
}

.prose .media-music iframe {
  height: 86px;
  border-radius: 0;
  background: transparent;
}

/* 点图片看大图（site.js） */
.prose.can-zoom img:not(a img) {
  cursor: zoom-in;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 20, 19, 0.9);
  cursor: zoom-out;
  animation: lightbox-in 0.15s ease-out;
}

.lightbox img {
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  border-radius: 8px;
  object-fit: contain;
}

@keyframes lightbox-in {
  from {
    opacity: 0;
  }
}

.prose :not(pre) > code {
  padding: 0.14em 0.4em;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-sunk);
  font-family: var(--mono);
  font-size: 0.86em;
  color: var(--accent-ink);
  overflow-wrap: anywhere;
}

.prose kbd {
  padding: 0.1em 0.45em;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 0.82em;
}

.table-wrap {
  margin: 1.6em 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.6;
}

.prose th,
.prose td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--bg-sunk);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.prose td {
  border-top: 1px solid var(--line);
}

/* ---------- 代码块 ---------- */

.code-block {
  margin: 1.6em 0;
  overflow: hidden;
  border: 1px solid var(--code-line);
  border-radius: 14px;
  background: var(--code-bg);
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 8px 6px 16px;
  background: var(--code-head);
  font-family: var(--sans);
  font-size: 0.78rem;
  line-height: 1.5;
  color: #a3a199;
}

.code-copy {
  padding: 3px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #c9c7bd;
  font: inherit;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.code-copy:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.code-copy.is-copied {
  color: #a8bf8b;
}

.code-block pre {
  margin: 0;
  padding: 16px 18px 18px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.875rem;
  line-height: 1.7;
  tab-size: 4;
  color: var(--code-text);
  scrollbar-width: thin;
  scrollbar-color: #55534e transparent;
}

.code-block code {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  white-space: pre;
}

/* 语法高亮：沿用站点的暖色系 */
.hljs-comment,
.hljs-quote,
.hljs-meta,
.hljs-doctag {
  color: #8e8c84;
}

.hljs-comment,
.hljs-quote {
  font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-tag,
.hljs-name,
.hljs-section,
.hljs-operator,
.hljs-meta .hljs-keyword {
  color: #e8926f;
}

.hljs-string,
.hljs-regexp,
.hljs-addition,
.hljs-meta .hljs-string,
.hljs-template-tag {
  color: #a8bf8b;
}

.hljs-number,
.hljs-literal,
.hljs-symbol,
.hljs-bullet,
.hljs-link {
  color: #e3b97c;
}

.hljs-title,
.hljs-title.function_,
.hljs-selector-id,
.hljs-selector-class {
  color: #8fb8e3;
}

.hljs-title.class_,
.hljs-type,
.hljs-built_in,
.hljs-class .hljs-title {
  color: #e6cf9a;
}

.hljs-attr,
.hljs-attribute,
.hljs-property,
.hljs-selector-attr,
.hljs-selector-pseudo {
  color: #b9c9e8;
}

.hljs-variable,
.hljs-template-variable,
.hljs-params {
  color: #edebe3;
}

.hljs-subst,
.hljs-punctuation {
  color: #cfcdc4;
}

.hljs-deletion {
  color: #e99aa9;
}

.hljs-emphasis {
  font-style: italic;
}

.hljs-strong {
  font-weight: 600;
}

/* ---------- 404 ---------- */

.notfound {
  padding: clamp(64px, 14vh, 140px) 0;
  text-align: center;
}

.notfound-code {
  margin: 0;
  font-family: var(--serif);
  font-size: 5.5rem;
  line-height: 1;
  color: var(--accent);
}

.notfound h1 {
  margin: 16px 0 0;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 400;
}

.notfound-text {
  margin: 12px 0 28px;
  color: var(--text-3);
}

/* ---------- 窄屏 ---------- */

@media (max-width: 1000px) {
  .skills {
    columns: 1;
  }
}

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

  .skills {
    columns: 2;
  }

  .footer-top {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .wrap {
    padding: 0 18px;
  }

  .skills {
    columns: 1;
  }

  .nav-in {
    height: 58px;
  }

  .nav-links a {
    padding: 7px 9px;
  }

  .post-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding: 18px 2px;
  }

  .post-row time {
    padding-top: 0;
    font-size: 0.82rem;
  }

  .post-row h3 {
    font-size: 1.2rem;
  }

  .post-row-arrow {
    display: none;
  }

  /* 订阅地址和按钮上下排，地址不会被挤得只剩半截 */
  .feed-box {
    flex-wrap: wrap;
    padding: 8px 8px 8px 14px;
  }

  .feed-url {
    flex-basis: calc(100% - 40px);
    font-size: 0.875rem;
  }

  /* 盒子左边多留了 6px 给图标，按钮往回收，两边才对称 */
  .feed-copy {
    width: calc(100% + 6px);
    margin-left: -6px;
  }

  /* 手机上项目卡片改成「左图右文」的紧凑横排，不然八张大图要划很久 */
  .project-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .project {
    flex-direction: row;
    align-items: stretch;
    gap: 4px;
    padding: 8px;
    border-radius: 16px;
  }

  .project-img {
    flex: none;
    width: 108px;
    aspect-ratio: 1;
    border-radius: 10px;
  }

  .project-body {
    min-width: 0;
    padding: 4px 6px 4px 10px;
  }

  .project h3 {
    font-size: 1.12rem;
  }

  .project-text {
    margin-top: 4px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    font-size: 0.86rem;
    line-height: 1.5;
  }

  .project-go {
    padding-top: 6px;
    font-size: 0.82rem;
  }

  .about {
    border-radius: 22px;
  }

  .article-body::before {
    right: 18px;
    left: 18px;
  }

  .article-nav {
    grid-template-columns: 1fr;
  }

  .article-nav-item.is-next {
    align-items: flex-start;
    text-align: left;
  }

  .prose {
    font-size: 1rem;
  }

  .code-block {
    margin-right: -18px;
    margin-left: -18px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .code-block pre {
    font-size: 0.82rem;
  }

  /* 折叠和提示框里的代码块不能再往两边伸出去 */
  .fold .code-block,
  .callout .code-block {
    margin-right: 0;
    margin-left: 0;
    border: 1px solid var(--code-line);
    border-radius: 12px;
  }

  /* 手机屏幕窄，「占 30%」会小得看不清：按百分比设的图片至少给到 240px，播放器一律撑满。
     按像素设的（比如 120）本来就是想要个小图，保持不变 */
  .prose .img-box[style*='%'] {
    min-width: min(100%, 240px);
  }

  .prose .media[style] {
    min-width: 100%;
  }

  .lightbox {
    padding: 8px;
  }

  .lightbox img {
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 4px;
  }
}

@media (max-width: 380px) {
  .brand span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .nav,
  .footer,
  .toc,
  .code-copy,
  .article-nav,
  .back,
  .lightbox {
    display: none !important;
  }
}
