:root {
  --paper: #f4f1e8;
  --paper-strong: #e9e4d6;
  --ink: #17211d;
  --muted: #66706a;
  --line: rgba(23, 33, 29, 0.16);
  --accent: #e95d36;
  --moss: #456b57;
  --code: #202823;
  --code-text: #eef2ed;
  --shadow: 0 22px 60px rgba(37, 42, 35, 0.11);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

:root[data-theme="dark"] {
  --paper: #141a17;
  --paper-strong: #1e2822;
  --ink: #edf0e9;
  --muted: #a4afa7;
  --line: rgba(237, 240, 233, 0.14);
  --accent: #ff7954;
  --moss: #8cb89c;
  --code: #0b0f0d;
  --code-text: #eef2ed;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 86% 8%, color-mix(in srgb, var(--moss) 14%, transparent), transparent 30rem),
    var(--paper);
}

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

button {
  color: inherit;
  font: inherit;
}

.site-header {
  width: min(1180px, calc(100% - 48px));
  min-height: 88px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--paper);
  background: var(--ink);
  border-radius: 50%;
  font-family: "Songti SC", "STSong", "SimSun", serif;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 14px;
  font-weight: 600;
}

.site-header nav a:hover {
  color: var(--accent);
}

.theme-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.hero {
  width: min(1180px, calc(100% - 48px));
  min-height: 650px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  align-items: center;
  gap: 80px;
}

.eyebrow,
.article-kicker {
  margin: 0 0 20px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.hero h1 {
  margin: 0;
  max-width: 780px;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: clamp(52px, 7vw, 92px);
  line-height: 1.1;
  letter-spacing: -0.055em;
}

.hero h1 em {
  color: var(--moss);
  font-style: normal;
}

.hero-lead {
  max-width: 660px;
  margin: 34px 0;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.9;
}

.primary-link {
  display: inline-flex;
  align-items: center;
  gap: 38px;
  padding: 16px 22px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 4px;
  font-weight: 600;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.primary-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.hero-orbit {
  position: relative;
  width: min(360px, 28vw);
  aspect-ratio: 1;
  margin: auto;
}

.orbit {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.orbit::after {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
}

.orbit-one {
  animation: spin 18s linear infinite;
}

.orbit-two {
  inset: 15%;
  animation: spin 12s linear infinite reverse;
}

.orbit-two::after {
  background: var(--moss);
}

.orbit-core {
  position: absolute;
  inset: 32%;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--paper);
  background: var(--ink);
  border-radius: 50%;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: clamp(18px, 2vw, 27px);
  font-weight: 800;
  line-height: 1.1;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.latest,
.about {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 100px 0;
  border-top: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 40px;
}

.section-heading h2,
.about h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: clamp(36px, 4vw, 58px);
  line-height: 1.2;
}

.section-heading > span {
  color: var(--muted);
  font-size: 13px;
}

.article-card {
  display: grid;
  grid-template-columns: 80px 1fr 50px;
  gap: 36px;
  padding: 44px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transition: padding 180ms ease, color 180ms ease;
}

.article-card:hover {
  padding-left: 16px;
  color: var(--accent);
}

.card-number {
  color: var(--muted);
  font-size: 13px;
}

.card-tags {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.card-tags span {
  padding: 5px 9px;
  color: var(--moss);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.card-copy h3 {
  max-width: 900px;
  margin: 0;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1.35;
}

.card-copy > p {
  max-width: 820px;
  color: var(--muted);
  line-height: 1.8;
}

.card-meta {
  display: flex;
  gap: 24px;
  color: var(--muted);
  font-size: 13px;
}

.card-arrow {
  font-size: 28px;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 100px;
  align-items: end;
}

.about-grid > p {
  margin: 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 2;
}

.site-footer {
  width: min(1180px, calc(100% - 48px));
  min-height: 100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.reading-progress {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
}

.article-layout {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 240px minmax(0, 780px);
  justify-content: space-between;
  gap: 80px;
  padding: 88px 0 120px;
}

.toc-panel {
  position: sticky;
  top: 40px;
  align-self: start;
  max-height: calc(100vh - 80px);
  padding-right: 22px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
}

.toc-title {
  margin-bottom: 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.toc-link {
  display: block;
  margin: 8px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  transition: color 150ms ease;
}

.toc-link.level-3 {
  padding-left: 12px;
}

.toc-link.active,
.toc-link:hover {
  color: var(--accent);
}

.article h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: clamp(42px, 5.3vw, 72px);
  line-height: 1.22;
  letter-spacing: -0.045em;
}

.article-deck {
  margin: 32px 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.85;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 18px 0 48px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.article-content {
  padding-top: 42px;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.95;
}

.article-content h2,
.article-content h3 {
  scroll-margin-top: 30px;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  line-height: 1.35;
}

.article-content h2 {
  margin: 76px 0 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 34px;
}

.article-content h3 {
  margin: 50px 0 18px;
  font-size: 25px;
}

.heading-anchor:hover {
  color: var(--accent);
}

.article-content p,
.article-content li {
  color: color-mix(in srgb, var(--ink) 88%, var(--muted));
}

.article-content a {
  color: var(--moss);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--moss) 40%, transparent);
  text-underline-offset: 4px;
}

.article-content blockquote {
  margin: 32px 0;
  padding: 20px 24px;
  color: var(--ink);
  background: var(--paper-strong);
  border-left: 4px solid var(--accent);
}

.article-content blockquote p {
  margin: 0;
}

.article-content pre {
  position: relative;
  margin: 28px 0;
  padding: 22px;
  overflow-x: auto;
  color: var(--code-text);
  background: var(--code);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.65;
}

.article-content :not(pre) > code {
  padding: 0.15em 0.4em;
  color: var(--accent);
  background: var(--paper-strong);
  border-radius: 4px;
  font-size: 0.88em;
}

.copy-code {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 8px;
  color: #cfd6d1;
  background: rgba(255, 255, 255, 0.08);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
}

.article-content table {
  width: 100%;
  margin: 28px 0;
  border-collapse: collapse;
  font-size: 14px;
}

.article-content th,
.article-content td {
  padding: 12px 14px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.article-content th {
  background: var(--paper-strong);
}

.article-content .mermaid {
  padding: 24px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.article-content hr {
  margin: 70px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.article-footer {
  margin-top: 90px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.article-footer p {
  color: var(--muted);
}

.article-footer a {
  color: var(--accent);
  font-weight: 700;
}

@media (max-width: 960px) {
  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 100px 0;
  }

  .hero-orbit {
    display: none;
  }

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

  .toc-panel {
    display: none;
  }
}

@media (max-width: 680px) {
  .site-header,
  .hero,
  .latest,
  .about,
  .site-footer,
  .article-layout {
    width: min(100% - 30px, 1180px);
  }

  .site-header {
    min-height: 72px;
  }

  .site-header nav a {
    display: none;
  }

  .hero {
    padding: 70px 0 80px;
  }

  .hero h1 {
    font-size: 48px;
  }

  .hero-lead {
    font-size: 17px;
  }

  .latest,
  .about {
    padding: 70px 0;
  }

  .article-card {
    grid-template-columns: 1fr auto;
    gap: 18px;
  }

  .card-number {
    display: none;
  }

  .card-copy h3 {
    font-size: 28px;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
  }

  .article-layout {
    padding-top: 58px;
  }

  .article h1 {
    font-size: 40px;
  }

  .article-content {
    font-size: 16px;
  }

  .article-content h2 {
    font-size: 28px;
  }

  .article-content table {
    display: block;
    overflow-x: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
