:root {
  --background: #f4f6f8;
  --foreground: #243041;
  --muted: #66758a;
  --card: #ffffff;
  --card-muted: #eef3f8;
  --border: #d7e0ea;
  --accent: #607996;
  --accent-contrast: #ffffff;
  --danger: #d92d20;
  --shadow: 0 12px 30px rgba(42,58,88,0.08);
  --markdown-code-bg: #edf2f7;
  --markdown-quote: #5d6b7c;
  --accent-soft: #e5edf4;
  --accent-soft-text: #49627e;
  --hero-start: #dce8f8;
  --hero-end: #f3e9dc;
  --hero-text: #213047;
  --hero-subtitle: #51637a;
  --hero-chip: rgba(255,255,255,0.72);
  --hero-chip-text: #37506d;
  --hero-border: rgba(116,137,165,0.24);
  --hero-orb: rgba(255,255,255,0.38);
  --composer-scroll-thumb: #8da6bf;
  --composer-scroll-track: #e8eef5;
  --content-width: 1280px;

  --bg: var(--background);
  --bg-elevated: var(--card);
  --text: var(--foreground);
  --text-soft: var(--muted);
}

html[data-theme=dark] {
  --background: #0f1623;
  --foreground: #e6edf7;
  --muted: #9cacbf;
  --card: #151d2b;
  --card-muted: #1b2535;
  --border: #2a3648;
  --accent: #7f98b6;
  --accent-contrast: #f8fbff;
  --danger: #f97066;
  --shadow: 0 12px 34px rgba(0,0,0,0.24);
  --markdown-code-bg: #121927;
  --markdown-quote: #9aa6b2;
  --accent-soft: #263448;
  --accent-soft-text: #d4e0f2;
  --hero-start: #1d2a3d;
  --hero-end: #2d2235;
  --hero-text: #eef4ff;
  --hero-subtitle: #bed0e7;
  --hero-chip: rgba(255,255,255,0.08);
  --hero-chip-text: #d9e6ff;
  --hero-border: rgba(145,170,212,0.16);
  --hero-orb: rgba(133,163,255,0.16);
  --composer-scroll-thumb: #5f7895;
  --composer-scroll-track: #1a2433;

  --bg: var(--background);
  --bg-elevated: var(--card);
  --text: var(--foreground);
  --text-soft: var(--muted);
}

* { box-sizing: border-box; }
html { font-size: 62.5%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.6rem/1.75 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", "Helvetica Neue", Arial, sans-serif;
}

code,
pre,
kbd,
samp {
  font-family: ui-monospace, SFMono-Regular, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.site-header, .site-shell, .site-footer { width: min(calc(100% - 32px), var(--content-width)); margin: 0 auto; }
.site-header { padding: 24px 0 18px; }
.site-header__inner {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, var(--hero-orb), transparent 34%),
    linear-gradient(135deg, var(--hero-start), var(--hero-end));
  box-shadow: var(--shadow);
}
.site-brand { display: flex; gap: 18px; align-items: center; min-width: 0; }
.site-brand__avatar img { width: 84px; height: 84px; object-fit: cover; border-radius: 50%; }
.site-brand__title { display: inline-block; font-size: 3rem; font-weight: 800; color: var(--hero-text); }
.site-brand__subtitle { margin: 6px 0 0; color: var(--hero-subtitle); }
.site-header__nav { display: flex; flex-direction: column; gap: 12px; }
.main-nav, .header-tools, .social-nav { display: flex; flex-wrap: wrap; gap: 10px; }
.main-nav__link, .header-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--hero-chip);
  color: var(--hero-chip-text);
  font-size: 1.45rem;
}
.header-tool--icon { width: 38px; min-width: 38px; padding: 0; }
.header-tool--toggle svg:last-of-type { display: none; }
html[data-theme=dark] .header-tool--toggle svg:first-of-type { display: none; }
html[data-theme=dark] .header-tool--toggle svg:last-of-type { display: inline-block; }
.header-tools { position: absolute; top: 24px; right: 24px; gap: 8px; }
.social-nav { gap: 8px; }
.social-nav__link {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; border: 1px solid var(--hero-border); color: var(--hero-chip-text); background: var(--hero-chip);
}
.social-nav__link svg, .header-tool svg { width: 16px; height: 16px; }
.site-shell { display: flex; flex-direction: column; gap: 28px; padding-bottom: 32px; }
.site-main, .sidebar-right { min-width: 0; }
.post-feed { display: grid; gap: 28px; }
.post-feed--home { grid-template-columns: 1fr; }
.post-feed--moments { grid-template-columns: 1fr; }
.post-feed--taxonomy { grid-template-columns: 1fr; }
.post-card { display: grid; gap: 14px; }
.post-card__cover img { width: 100%; height: min(200px, 28vw); object-fit: cover; border-radius: 18px; }
.post-feed--home .post-card__cover img { height: 160px; }
.post-card__categories, .meta-categories { display: flex; flex-wrap: wrap; gap: 10px; }
.post-card__categories a, .meta-categories a { color: var(--text-soft); font-size: 1.35rem; }
.post-card__title, .article-page__meta h1 { margin: 0; font-size: clamp(1.65rem, 1.4vw, 2rem); font-weight: 500; line-height: 1.35; letter-spacing: -0.01em; }
.post-card__title a { color: color-mix(in srgb, var(--text) 84%, white 16%); }
.post-feed--home .post-card__title { font-size: 1.5rem; }
.post-card__meta, .meta-line { display: flex; flex-wrap: wrap; gap: 14px; color: var(--text-soft); font-size: 1.35rem; }
.translation-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  color: var(--text-soft);
  position: relative;
  top: 0.12rem;
  transition: color 0.2s ease, transform 0.2s ease;
}
.translation-toggle:hover {
  color: var(--accent);
  transform: translateY(-1px);
}
.translation-toggle svg {
  width: 1.4rem;
}
.post-card--taxonomy { gap: 12px; }
.post-card--taxonomy .post-card__cover img { height: 150px; }
.post-card--taxonomy .post-card__title { font-size: 1.5rem; }
.meta-sep { color: var(--text-soft); opacity: 0.65; }
.post-card--moment {
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}
.post-card--moment .post-card__body {
  display: grid;
  gap: 12px;
}
.moment-content .article-content,
.moment-content {
  font-size: 1.6rem;
}
.article-page, .list-page, .archives-page, .search-page {
  padding: 24px; border: 1px solid var(--border); border-radius: 24px; background: var(--bg-elevated); box-shadow: var(--shadow);
}
.article-page__header { display: grid; gap: 23px; }
.article-page__cover img { width: 100%; max-height: 400px; border-radius: 20px; object-fit: cover; }
.article-page__description, .section-head p { color: var(--text-soft); }
.article-page__content { display: grid; gap: 24px; margin-top: 28px; }
.article-page__meta {
  display: grid;
  gap: 14px;
}
.article-page__meta h1 {
  margin: 0 0 0.35rem;
  font-weight: 900;
}
.article-page__meta .meta-line {
  justify-content: flex-end;
  margin-bottom: 0.4rem;
}
.article-content { min-width: 0; }
.article-content img { border-radius: 16px; }
.article-content a { color: var(--accent); }
.article-content > * { max-width: 100%; }
.article-content {
  color: color-mix(in srgb, var(--text) 95%, white 5%);
  font-size: 1.72rem;
  line-height: 1.9;
  letter-spacing: 0.01em;
}
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
  margin: 1.9em 0 0.75em;
  line-height: 1.32;
  color: var(--foreground);
  font-weight: 700;
  letter-spacing: -0.018em;
  scroll-margin-top: 2rem;
}
.article-content > :first-child {
  margin-top: 0;
}
.article-content h1 { font-size: 2.6rem; padding-bottom: 0.35em; border-bottom: 1px solid var(--border); }
.article-content h2 { font-size: 2.2rem; padding-bottom: 0.3em; border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent 28%); }
.article-content h3 { font-size: 1.9rem; }
.article-content h4 { font-size: 1.72rem; }
.article-content h5,
.article-content h6 { font-size: 1.55rem; }
.article-content p,
.article-content ul,
.article-content ol,
.article-content blockquote,
.article-content pre,
.article-content table {
  margin: 0 0 1.4em;
}
.article-content p {
  overflow-wrap: break-word;
  text-align: justify;
}
.article-content ul,
.article-content ol {
  padding-left: 1.65em;
}
.article-content li + li {
  margin-top: 0.42em;
}
.article-content li > p {
  margin-bottom: 0.6em;
}
.article-content ul ul,
.article-content ul ol,
.article-content ol ul,
.article-content ol ol {
  margin-top: 0.55em;
  margin-bottom: 0.8em;
}
.article-content hr {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 3.2rem 0;
}
.article-content blockquote {
  margin: 1.7em 0;
  padding: 0.45rem 1.6rem 0.45rem 1.8rem;
  border-left: 4px solid var(--accent);
  color: var(--markdown-quote);
  background: linear-gradient(90deg, color-mix(in srgb, var(--card-muted) 88%, transparent 12%), transparent);
  border-radius: 0 14px 14px 0;
}
.article-content blockquote > :last-child {
  margin-bottom: 0;
}
.article-content blockquote p {
  text-align: left;
}
.article-content :not(pre) > code {
  display: inline;
  padding: 0.18em 0.42em;
  border-radius: 0.6rem;
  background: var(--markdown-code-bg);
  color: var(--accent-soft-text);
  font-size: 0.9em;
  overflow-wrap: anywhere;
  word-break: break-word;
  border: 1px solid color-mix(in srgb, var(--border) 65%, transparent 35%);
}
.article-content pre {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 1.8rem 1.8rem;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent 18%);
  background: var(--markdown-code-bg);
  -webkit-overflow-scrolling: touch;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}
.article-content pre code {
  display: block;
  min-width: max-content;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
  font-size: 1.42rem;
  line-height: 1.7;
}
.article-content .highlight {
  margin: 0 0 1.45em;
}
.article-content .highlight pre {
  margin: 0;
}
.article-content .lntable,
.article-content .lntd {
  border: 0 !important;
  background: transparent !important;
  padding: 0 !important;
}
.article-content .lntable {
  border-spacing: 0 !important;
  width: auto !important;
  overflow: visible !important;
}
.article-content .lntd:first-child {
  padding-right: 1rem !important;
}
.article-content .lnt,
.article-content .ln {
  color: var(--muted);
  opacity: 0.75;
}
.article-content .copy-code-button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  min-height: 3rem;
  padding: 0 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 88%, transparent 12%);
  color: var(--text-soft);
  font-size: 1.2rem;
  cursor: pointer;
}
.article-content .copy-code-button:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border) 65%);
}
.article-content strong {
  font-weight: 700;
}
.article-content del {
  color: var(--muted);
}
.article-content mark {
  padding: 0.08em 0.2em;
  border-radius: 0.35rem;
  background: color-mix(in srgb, var(--hero-end) 72%, #fff 28%);
  color: inherit;
}
.article-content table thead th {
  font-weight: 700;
}
.article-content table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  -webkit-overflow-scrolling: touch;
  border-spacing: 0;
  border-radius: 14px;
}
.article-content th,
.article-content td {
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.article-content th {
  background: color-mix(in srgb, var(--card-muted) 92%, #fff 8%);
}
.article-content tbody tr:nth-child(2n) {
  background: color-mix(in srgb, var(--card-muted) 42%, transparent 58%);
}
.article-content iframe,
.article-content video {
  max-width: 100%;
  border-radius: 16px;
}
.article-content figure {
  margin: 1.8em 0;
}
.article-content figcaption {
  margin-top: 0.9rem;
  color: var(--text-soft);
  font-size: 1.35rem;
  text-align: center;
}
.article-content .footnotes {
  margin-top: 2.8rem;
  padding-top: 1.8rem;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 1.5rem;
}
.article-content .footnotes ol {
  padding-left: 1.4em;
}
.article-content .footnote-ref,
.article-content .footnote-backref {
  color: var(--accent);
  font-weight: 600;
}
.article-page__description {
  margin: 0;
  padding: 0.4rem 0 0.4rem 1.6rem;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--card-muted) 78%, transparent 22%);
  border-radius: 0 12px 12px 0;
  font-size: 1.55rem;
  line-height: 1.7;
  margin-top: 0.4rem;
}
.article-toc, .widget-simple, .comments-card { padding: 18px; border: 1px solid var(--border); border-radius: 20px; background: var(--bg-elevated); }
.widget-simple { display: flex; flex-direction: column; gap: 14px; }
.widget-simple__title { margin: 0; font-size: 1.7rem; }
.widget-simple--categories {
  align-items: center;
}
.widget-simple--categories .widget-simple__title {
  text-align: center;
}
.widget-simple--categories .widget-simple__tabs {
  justify-content: center;
}
.widget-simple__list { display: flex; flex-direction: column; gap: 2px; }
.widget-simple__row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); color: var(--text-soft); }
.widget-simple__row:last-child { border-bottom: 0; }
.widget-simple--archives .widget-simple__row { font-size: 1.3rem; }
.widget-simple__tabs {display: flex;flex-wrap: wrap;gap: 10px;justify-content: center;}
.widget-simple__tab {
  display: inline-flex;
  align-items: center;
  min-height: 3.2rem;
  padding: 0 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 84%, var(--accent-soft) 16%);
  color: var(--accent-soft-text);
  font-size: 1.3rem;
  line-height: 1;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.widget-simple__tab:hover {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border) 70%);
  color: var(--accent);
  transform: translateY(-1px);
}
.widget-search input, .search-box input {
  width: 100%; min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: 14px; background: transparent; color: var(--text);
}
.widget-search input::placeholder,
.search-box input::placeholder {
  color: transparent;
}
.sidebar-right { display: flex; flex-direction: column; gap: 20px; }
.widget-wechat {
  display: flex;
  justify-content: center;
}
.widget-wechat img {
  width: 110px;
  height: 110px;
  border-radius: 12px;
}
.widget-simple__row--related {
  justify-content: flex-start;
  border-bottom: 0;
  padding: 0;
  line-height: 1.6;
}
.widget-simple__row--related + .widget-simple__row--related {
  margin-top: 0.5rem;
}
.toc-widget {
  max-height: 52rem;
  overflow: auto;
  padding-right: 0.6rem;
}
.toc-widget ul,
.toc-widget ol {
  margin: 0;
  padding-left: 1.6rem;
}
.toc-widget li + li {
  margin-top: 0.5rem;
}
.toc-widget li {
  line-height: 1.6;
}
.toc-widget a {
  color: var(--text-soft);
}
.toc-widget a:hover {
  color: var(--accent);
}
.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  color: var(--text-soft);
  font-size: 1.3rem;
}
.pagination__link,
.pagination__current {
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 88%, var(--accent-soft) 12%);
}
.pagination__link:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border) 70%);
}
.pagination__current {
  min-width: 5.8rem;
  text-align: center;
}
.section-head { margin-bottom: 24px; }
.section-head__eyebrow { margin: 0 0 8px; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.08em; font-size: 1.2rem; }
.archive-year { margin-top: 28px; }
.archive-year__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.archive-year__list { display: flex; flex-direction: column; gap: 10px; }
.archive-entry { display: flex; justify-content: space-between; gap: 18px; color: var(--text-soft); }
.links-grid__items { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.friend-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}
.friend-card__media {
  height: 84px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.friend-card__media img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.friend-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
  align-items: center;
}
.friend-card__body strong {
  font-size: 1.6rem;
  line-height: 1.4;
}
.friend-card__body span {
  color: var(--text-soft);
  font-size: 1.4rem;
  line-height: 1.65;
}
.search-results { display: grid; gap: 18px; margin-top: 20px; }
.search-result { padding: 18px; border: 1px solid var(--border); border-radius: 18px; }
.site-footer { padding: 0 0 32px; color: var(--text-soft); font-size: 1.35rem; }
.site-footer p { margin: 0; text-align: center; }

@media (min-width: 1024px) {
  .site-shell { flex-direction: row; align-items: flex-start; }
  .site-main { flex: 1 1 auto; }
  .sidebar-right { width: 280px; max-width: 280px; flex: 0 0 280px; position: sticky; top: 20px; }
  .post-feed--home { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .post-feed--taxonomy { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-header__nav { flex-direction: row; align-items: center; justify-content: space-between; gap: 14px; }
  .main-nav, .social-nav, .header-tools { flex-wrap: nowrap; }
}

@media (max-width: 1023.98px) {
  .widget-simple--archives {
    display: none;
  }
  .pagination {
    justify-content: center;
  }
  .site-header__nav {
    align-items: center;
  }
  .main-nav,
  .social-nav {
    justify-content: center;
  }
  .header-tools {
    justify-content: flex-end;
  }
  .site-header__inner { gap: 16px; }
  .site-brand { align-items: center; }
  .site-brand__text { text-align: center; }
}
@media (max-width: 767px) {
  .article-content {
    font-size: 1.58rem;   /* 15.8px，比桌面端稍小 */
    line-height: 1.8;
  }
  .article-content p {
    text-align: left;     /* 手机上关掉 justify */
  }
}
