:root {
  color-scheme: light;
  --bg: #fbfaf7;
  --paper: #fffdf8;
  --text: #20211e;
  --muted: #6f6a60;
  --faint: #969086;
  --soft: #ebe5da;
  --line: #d9d1c4;
  --accent: #934127;
  --accent-soft: #f1ded6;
  --max: 1120px;
  --article: 720px;
  --article-wide: 880px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 17px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  line-height: 1.68;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern";
}

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, currentColor 34%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 160ms var(--ease), text-decoration-color 160ms var(--ease), background-color 160ms var(--ease), border-color 160ms var(--ease);
}

a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

a:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 62%, transparent);
  outline-offset: 4px;
  border-radius: 3px;
}

::selection {
  background: color-mix(in srgb, var(--accent-soft) 78%, white);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

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

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 34px 0 72px;
}

.brand {
  display: grid;
  gap: 2px;
  text-decoration: none;
}

.brand span {
  font-size: 1.02rem;
  font-weight: 720;
  line-height: 1.2;
}

.brand small,
.site-nav,
.section-label,
.article-meta,
.muted,
.site-footer {
  color: var(--muted);
  font-size: 0.84rem;
}

.article-meta,
.archive-list time,
.featured-year {
  font-variant-numeric: tabular-nums;
}

.brand small {
  line-height: 1.35;
}

.site-nav {
  display: flex;
  gap: 20px;
  line-height: 1.2;
}

.intro-section,
.content-section {
  display: grid;
  grid-template-columns: minmax(118px, 0.255fr) minmax(0, 1fr);
  gap: 40px;
  padding: 0 0 84px;
}

.content-section {
  border-top: 1px solid var(--line);
  padding-top: 44px;
}

.section-label {
  padding-top: 0.5rem;
  color: var(--faint);
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: 0;
  text-wrap: balance;
}

h1 {
  max-width: 900px;
  font-size: clamp(3.35rem, 10.2vw, 8rem);
  font-weight: 780;
  line-height: 0.98;
}

h2 {
  margin-bottom: 30px;
  max-width: 760px;
  font-size: clamp(2.4rem, 5.7vw, 4.7rem);
  font-weight: 700;
  line-height: 0.98;
}

h3 {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 680;
}

.intro-copy {
  max-width: 740px;
  margin: 28px 0 0;
  font-size: clamp(1.16rem, 2.25vw, 1.62rem);
  line-height: 1.52;
}

.intro-links {
  display: flex;
  gap: 20px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.home-image {
  width: min(100%, var(--article-wide));
  margin: 42px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.home-image img {
  width: 100%;
  height: 292px;
  border-radius: 3px;
  object-fit: cover;
  object-position: center 58%;
  filter: saturate(0.88) contrast(0.96) brightness(1.02);
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.featured-item {
  background: var(--bg);
}

.featured-item + .featured-item {
  border-left: 1px solid var(--line);
}

.featured-item a {
  display: flex;
  min-height: 214px;
  padding: 24px 26px 22px;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none;
}

.featured-item a:hover {
  background: color-mix(in srgb, var(--paper) 76%, var(--accent-soft));
}

.featured-title {
  font-size: clamp(1.34rem, 2.2vw, 1.85rem);
  font-weight: 720;
  line-height: 1.12;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

.featured-desc {
  max-width: 34em;
  margin-top: 22px;
  color: var(--muted);
  line-height: 1.45;
}

.featured-year {
  display: block;
  margin-top: 18px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 680;
}

.archive {
  display: grid;
  gap: 30px;
}

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

.archive-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.archive-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 18px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.archive-list li:first-child {
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.archive-list a {
  overflow-wrap: anywhere;
}

.archive-list time {
  color: var(--faint);
  font-size: 0.82rem;
  text-align: right;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 42px 0 38px;
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin: 0;
}

.site-footer p:first-child {
  display: flex;
  gap: 10px;
}

.article-shell {
  display: block;
}

.article {
  width: 100%;
  max-width: var(--article-wide);
  margin: 0 auto;
  min-width: 0;
}

.article-header {
  padding-bottom: 42px;
}

.article-header h1 {
  margin-top: 24px;
  max-width: var(--article-wide);
  font-size: clamp(2.24rem, 4.7vw, 3.9rem);
  line-height: 1.14;
  font-weight: 740;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

.back-link {
  color: var(--muted);
  font-size: 0.86rem;
}

.back-link::before {
  content: "← ";
}

.article-meta,
.article-desc,
.tags {
  margin: 20px 0 0;
}

.article-desc {
  width: 100%;
  max-width: var(--article);
  color: var(--muted);
  font-size: clamp(1.08rem, 1.8vw, 1.25rem);
  line-height: 1.58;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
  background: color-mix(in srgb, var(--paper) 72%, transparent);
}

.article-body {
  width: 100%;
  max-width: var(--article);
  padding-bottom: 80px;
}

.article-body > * + * {
  margin-top: 1.12em;
}

.article-body > .table-scroll + *,
.article-body > pre + *,
.article-body > blockquote + *,
.article-body > figure + * {
  margin-top: 1.35em;
}

.article-body h2,
.article-body h3,
.article-body h4,
.article-body h5,
.article-body h6 {
  margin-top: 1.9em;
  line-height: 1.22;
}

.article-body h2 {
  font-size: clamp(1.5rem, 2.4vw, 1.78rem);
}

.article-body h3 {
  color: var(--text);
  font-size: 1.18rem;
}

.article-body h4,
.article-body h5,
.article-body h6 {
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 720;
}

.article-body p,
.article-body li,
.article-body th,
.article-body td {
  font-size: 1.02rem;
  line-height: 1.82;
  overflow-wrap: anywhere;
}

.article-body ul,
.article-body ol {
  padding-left: 1.35rem;
}

.article-body li + li {
  margin-top: 0.32em;
}

.article-body li > ul,
.article-body li > ol {
  margin-top: 0.32em;
  padding-left: 1.2rem;
}

.article-body li > p {
  margin: 0.45em 0;
}

.article-body .task-list-item {
  list-style: none;
  margin-left: -1.35rem;
}

.task-list-item-checkbox {
  width: 0.95em;
  height: 0.95em;
  margin: 0 0.55em 0 0;
  vertical-align: -0.12em;
  accent-color: var(--accent);
}

.article-body a {
  overflow-wrap: anywhere;
}

.article-body blockquote {
  margin-right: 0;
  margin-left: 0;
  padding: 0.25rem 0 0.25rem 1.05rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}

.article-body blockquote > :first-child {
  margin-top: 0;
}

.article-body blockquote > :last-child {
  margin-bottom: 0;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}

.article-body table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.article-body th,
.article-body td {
  padding: 0.7rem 0.85rem 0.72rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  text-align: left;
  vertical-align: top;
}

.article-body th {
  color: var(--text);
  font-weight: 720;
  line-height: 1.42;
  white-space: nowrap;
}

.article-body td {
  color: color-mix(in srgb, var(--text) 92%, var(--muted));
}

.article-body tr:last-child td {
  border-bottom: 0;
}

.article-body th[style*="right"],
.article-body td[style*="right"] {
  text-align: right;
  white-space: nowrap;
}

.article-body pre {
  overflow-x: auto;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f5f1e9;
  line-height: 1.65;
  -webkit-overflow-scrolling: touch;
}

.article-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
}

.article-body :not(pre) > code {
  border-radius: 4px;
  padding: 0.1em 0.32em;
  background: var(--accent-soft);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.article-body sup {
  font-size: 0.72em;
  line-height: 0;
}

.article-body sup a {
  text-decoration: none;
}

.article-body img {
  margin: 1.55rem 0;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.article-body hr {
  margin: 2.4rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.footnotes {
  margin-top: 2.6rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.footnotes ol {
  margin-bottom: 0;
  padding-left: 1.25rem;
}

.footnotes li,
.footnotes p {
  font-size: 0.92rem;
  line-height: 1.68;
}

.footnote-backref {
  text-decoration: none;
}

.heading-anchor {
  margin-left: 0.35em;
  color: var(--muted);
  text-decoration: none;
  opacity: 0;
}

h2:hover .heading-anchor,
h3:hover .heading-anchor {
  opacity: 1;
}

@media (max-width: 760px) {
  html {
    font-size: 16px;
  }

  .page-shell {
    width: min(100% - 30px, var(--max));
  }

  .site-header,
  .site-footer {
    display: grid;
  }

  .site-header {
    padding: 34px 0 58px;
  }

  .intro-section,
  .content-section,
  .archive-year {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .intro-section,
  .content-section {
    padding-bottom: 58px;
  }

  h1 {
    font-size: clamp(3.15rem, 17vw, 4.9rem);
    line-height: 1;
  }

  h2 {
    margin-bottom: 26px;
    font-size: clamp(2.15rem, 12vw, 3.35rem);
  }

  .article-header h1 {
    font-size: clamp(1.86rem, 7.35vw, 2.32rem);
    line-height: 1.18;
    text-wrap: auto;
    word-break: break-word;
  }

  .intro-copy {
    margin-top: 22px;
    font-size: 1.12rem;
    line-height: 1.56;
  }

  .intro-links {
    margin-top: 24px;
  }

  .home-image {
    margin-top: 34px;
    padding: 8px 0;
  }

  .home-image img {
    height: 210px;
    object-position: center 58%;
  }

  .featured-grid {
    grid-template-columns: 1fr;
  }

  .featured-item + .featured-item {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .featured-item a {
    min-height: 172px;
    padding: 22px;
  }

  .featured-title {
    font-size: clamp(1.35rem, 7vw, 1.8rem);
  }

  .archive-list li {
    grid-template-columns: 1fr;
    gap: 3px;
    padding: 11px 0;
  }

  .archive-list time {
    text-align: left;
  }

  .article-header {
    padding-bottom: 34px;
  }

  .article-body p,
  .article-body li {
    line-height: 1.78;
  }

  .article-body ul,
  .article-body ol {
    padding-left: 1.16rem;
  }

  .article-body .task-list-item {
    margin-left: -1.16rem;
  }

  .table-scroll {
    margin-right: -15px;
    padding-right: 15px;
  }

  .article-body table {
    min-width: 560px;
  }

  .article-body th,
  .article-body td {
    padding-top: 0.62rem;
    padding-bottom: 0.64rem;
  }

  .article-body pre {
    padding: 15px 16px;
  }

  .site-footer {
    padding-bottom: 32px;
  }
}
