:root {
  color-scheme: light;
  --background: #f8f8f5;
  --surface: #ffffff;
  --text: #242622;
  --muted: #6c7169;
  --line: #e5e6e0;
  --accent: #356859;
  --accent-soft: #e8f0ec;
  --code-background: #202521;
  --code-text: #eef2ed;
  --page-width: 960px;
  --article-width: 760px;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--background);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: #244c40;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 8px 12px;
  color: var(--surface);
  background: var(--text);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(248, 248, 245, 0.92);
  backdrop-filter: blur(12px);
}

.header-inner,
.page-shell {
  width: min(var(--page-width), calc(100% - 40px));
  margin: 0 auto;
}

.header-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-name {
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 24px;
}

.site-nav a {
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

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

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.not-found h1 {
  max-width: 700px;
  margin: 0;
  font-size: clamp(38px, 7vw, 64px);
  line-height: 1.12;
  letter-spacing: -0.045em;
}

.not-found > p {
  max-width: 620px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.post-list {
  padding: 64px 0 96px;
}

.blog-home-layout {
  width: min(1180px, calc(100% - 40px));
}

.blog-home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 64px;
  align-items: start;
}

.blog-sidebar {
  display: grid;
  gap: 24px;
  padding: 64px 0 96px;
}

.sidebar-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.sidebar-panel-header {
  display: flex;
  min-height: 58px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  gap: 10px;
}

.sidebar-panel-header svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-panel-header h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.sidebar-recent-posts,
.sidebar-taxonomy-list {
  margin: 0;
  padding: 14px 18px 17px;
  list-style: none;
}

.sidebar-recent-posts li {
  position: relative;
  padding: 5px 0 5px 15px;
}

.sidebar-recent-posts li::before {
  position: absolute;
  top: 0.93em;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #b6bab4;
  content: "";
}

.sidebar-recent-posts a {
  display: block;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  text-decoration: none;
}

.sidebar-recent-posts a:hover {
  color: var(--accent);
}

.sidebar-taxonomy-list {
  padding: 0;
}

.sidebar-taxonomy-list li + li {
  border-top: 1px solid var(--line);
}

.sidebar-taxonomy-list a {
  display: flex;
  min-height: 48px;
  padding: 8px 16px 8px 18px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
}

.sidebar-taxonomy-list a:hover {
  color: var(--accent);
  background: #fafbf8;
}

.taxonomy-count {
  display: inline-flex;
  min-width: 30px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  color: var(--surface);
  background: #aeb4ae;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.sidebar-tag-cloud {
  display: flex;
  padding: 20px 18px 22px;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 7px 12px;
}

.sidebar-tag-cloud a {
  color: var(--muted);
  font-size: calc(13px + var(--tag-weight) * 1.5px);
  line-height: 1.35;
  text-decoration: none;
}

.sidebar-tag-cloud a:hover {
  color: var(--accent);
}

.sidebar-empty {
  margin: 0;
  padding: 18px;
  color: var(--muted);
  font-size: 14px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.section-heading h2 {
  margin: 0 0 16px;
  font-size: 18px;
}

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

.post-card {
  position: relative;
  padding: 34px 0 36px;
  border-bottom: 1px solid var(--line);
}

.post-card time,
.article-meta {
  color: var(--muted);
  font-size: 13px;
}

.post-kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.post-kicker a,
.article-meta a {
  color: var(--accent);
  text-decoration: none;
}

.post-card h3 {
  max-width: 720px;
  margin: 8px 0 10px;
  font-size: clamp(23px, 4vw, 30px);
  line-height: 1.3;
  letter-spacing: -0.025em;
}

.post-card h3 a {
  color: var(--text);
  text-decoration: none;
}

.post-card h3 a:hover {
  color: var(--accent);
}

.post-card > p {
  max-width: 720px;
  margin: 0 0 14px;
  color: var(--muted);
}

.blog-pagination {
  display: grid;
  grid-template-columns: minmax(92px, 1fr) auto minmax(92px, 1fr);
  gap: 18px;
  padding-top: 36px;
  align-items: center;
  border-top: 1px solid var(--line);
}

.pagination-pages {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pagination-link {
  display: inline-flex;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

a.pagination-link:hover {
  border-color: #bccac3;
  color: var(--accent);
}

.pagination-link.is-current {
  border-color: var(--accent);
  color: var(--surface);
  background: var(--accent);
}

.pagination-link.is-disabled {
  color: #b2b6b0;
  background: transparent;
}

.pagination-direction:first-child {
  justify-self: start;
}

.pagination-direction:last-child {
  justify-self: end;
}

.pagination-ellipsis {
  min-width: 22px;
  color: var(--muted);
  text-align: center;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 16px 0;
  padding: 0;
  list-style: none;
}

.tag-list li {
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
}

.tag-list a {
  color: inherit;
  text-decoration: none;
}

.read-more,
.back-link {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.empty-state {
  padding: 72px 20px;
  color: var(--muted);
  text-align: center;
}

.empty-state p {
  margin: 0;
  color: var(--text);
  font-size: 20px;
}

.collection-hero {
  padding: 72px 0 48px;
  border-bottom: 1px solid var(--line);
}

.collection-hero h1 {
  margin: 0;
  font-size: clamp(36px, 6vw, 52px);
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.collection-hero > p:last-child {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.archive {
  padding: 56px 0 96px;
}

.archive-year {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 24px;
  padding: 0 0 48px;
}

.archive-year > h2 {
  margin: 0;
  color: var(--accent);
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.archive-month + .archive-month {
  margin-top: 38px;
}

.archive-month h3 {
  margin: 0 0 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.archive-month ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.archive-month li {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 16px;
  padding: 10px 0;
}

.archive-month time {
  color: var(--muted);
  font-size: 13px;
}

.archive-month a {
  color: var(--text);
  font-weight: 600;
  line-height: 1.45;
  text-decoration: none;
}

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

.taxonomy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 56px 0 96px;
}

.taxonomy-card {
  display: flex;
  min-height: 110px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  flex-direction: column;
  justify-content: space-between;
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease;
}

.taxonomy-card:hover {
  border-color: #bccac3;
  color: var(--accent);
  transform: translateY(-2px);
}

.taxonomy-card span {
  font-size: 18px;
  font-weight: 700;
}

.taxonomy-card small {
  color: var(--muted);
  font-size: 12px;
}

.article-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 72px 0 96px;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--article-width)) 240px;
  gap: 64px;
  align-items: start;
  justify-content: center;
}

.article-main-column {
  min-width: 0;
}

.article-header {
  margin-bottom: 40px;
}

.article-header h1 {
  margin: 24px 0 18px;
  font-size: clamp(36px, 7vw, 58px);
  line-height: 1.16;
  letter-spacing: -0.04em;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.article-cover {
  display: block;
  width: 100%;
  max-height: 480px;
  margin: 0 0 40px;
  border-radius: var(--radius);
  object-fit: cover;
}

.article-toc {
  margin: 0 0 40px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.article-toc-mobile {
  display: none;
}

.article-toc summary {
  cursor: pointer;
  font-weight: 650;
}

.article-toc .toc > ul {
  margin-bottom: 0;
}

.article-toc ul {
  padding-left: 22px;
}

.article-toc a {
  font-size: 14px;
}

.article-toc-sidebar {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  margin-top: 72px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.article-toc-panel {
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.article-toc-title {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.article-toc-sidebar .toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.article-toc-sidebar .toc ul ul {
  margin-top: 5px;
  padding-left: 14px;
}

.article-toc-sidebar .toc li + li {
  margin-top: 5px;
}

.article-toc-sidebar .toc a {
  display: block;
  padding: 3px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-decoration: none;
  transition: color 140ms ease, transform 140ms ease;
}

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

.article-toc-sidebar .toc a[aria-current="location"] {
  color: var(--accent);
  font-weight: 700;
  transform: translateX(3px);
}

.article-content {
  font-family: ui-serif, Georgia, "Songti SC", "STSong", serif;
  font-size: 18px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

.article-content h2,
.article-content h3 {
  scroll-margin-top: 24px;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.article-content h2 {
  margin: 2.5em 0 0.8em;
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--line);
  font-size: 28px;
}

.article-content h3 {
  margin: 2em 0 0.6em;
  font-size: 22px;
}

.article-content p,
.article-content ul,
.article-content ol {
  margin: 1.1em 0;
}

.article-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 32px auto;
  border-radius: 8px;
}

.article-content blockquote {
  margin: 1.5em 0;
  padding: 2px 0 2px 20px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.article-content code {
  padding: 0.15em 0.35em;
  border-radius: 4px;
  color: #7b3535;
  background: #eee9e4;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.86em;
}

.article-content pre {
  max-width: 100%;
  margin: 1.7em 0;
  padding: 20px;
  border-radius: 10px;
  background: var(--code-background);
  overflow-x: auto;
}

.article-content pre code {
  padding: 0;
  color: var(--code-text);
  background: transparent;
  font-size: 14px;
  line-height: 1.7;
}

.article-content .mermaid {
  max-width: 100%;
  margin: 1.7em 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow-x: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  text-align: center;
}

.article-content .mermaid svg {
  display: block;
  max-width: 100% !important;
  height: auto;
  margin: 0 auto;
}

.article-content table {
  display: block;
  width: 100%;
  margin: 1.7em 0;
  border-collapse: collapse;
  overflow-x: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

.article-content th,
.article-content td {
  padding: 10px 14px;
  border: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.article-content th {
  background: #eff0eb;
}

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

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

.site-footer {
  width: min(var(--page-width), calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.site-footer p {
  margin: 0;
}

.not-found {
  min-height: 65vh;
  padding: 120px 0;
}

.button-link {
  display: inline-block;
  margin-top: 30px;
  padding: 10px 16px;
  border-radius: 8px;
  color: var(--surface);
  background: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.button-link:hover {
  color: var(--surface);
  background: #244c40;
}

@media (max-width: 1120px) {
  .article-shell {
    width: min(var(--article-width), calc(100% - 40px));
  }

  .article-layout {
    display: block;
  }

  .article-toc-sidebar {
    display: none;
  }

  .article-toc-mobile {
    display: block;
  }
}

@media (max-width: 960px) {
  .blog-home-layout {
    width: min(var(--page-width), calc(100% - 40px));
  }

  .blog-home-layout {
    display: block;
  }

  .blog-home-layout .post-list {
    padding-bottom: 24px;
  }

  .blog-sidebar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding-top: 0;
  }
}

@media (max-width: 640px) {
  .header-inner,
  .page-shell,
  .article-shell,
  .site-footer {
    width: min(100% - 28px, var(--page-width));
  }

  .header-inner {
    min-height: auto;
    padding: 14px 0 12px;
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .site-nav {
    width: 100%;
    gap: 16px;
    padding-bottom: 2px;
    overflow-x: auto;
    white-space: nowrap;
  }

  .post-list {
    padding: 44px 0 72px;
  }

  .blog-home-layout {
    width: min(100% - 28px, var(--page-width));
  }

  .blog-home-layout .post-list {
    padding-bottom: 16px;
  }

  .blog-sidebar {
    grid-template-columns: 1fr;
    padding-bottom: 72px;
  }

  .collection-hero {
    padding: 52px 0 38px;
  }

  .archive {
    padding: 42px 0 72px;
  }

  .archive-year {
    display: block;
  }

  .archive-year > h2 {
    margin-bottom: 28px;
  }

  .taxonomy-grid {
    grid-template-columns: 1fr;
    padding: 42px 0 72px;
  }

  .taxonomy-card {
    min-height: 96px;
  }

  .post-card {
    padding: 28px 0 30px;
  }

  .blog-pagination {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .pagination-pages {
    grid-column: 1 / -1;
    grid-row: 1;
    flex-wrap: wrap;
  }

  .pagination-direction {
    width: 100%;
  }

  .article-shell {
    padding: 48px 0 72px;
  }

  .article-header {
    margin-bottom: 30px;
  }

  .article-content {
    font-size: 17px;
    line-height: 1.85;
  }

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

  .article-content pre {
    margin-right: -4px;
    margin-left: -4px;
    padding: 16px;
    border-radius: 8px;
  }
}
