:root {
  color-scheme: light dark;
  --background: #fbfcfc;
  --foreground: #202526;
  --muted: #697273;
  --faint: #dce1e1;
  --accent: #087d78;
  --accent-hover: #075e5b;
  --code-background: #f0f3f3;
  --quote-border: #9aa6a6;
  --content-width: 44rem;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
}

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

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

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.site-shell {
  width: min(calc(100% - 3rem), var(--content-width));
  margin-inline: auto;
  padding: 5rem 0 4rem;
}

.site-header {
  margin-bottom: 3.5rem;
}

.site-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 680;
  line-height: 1.25;
}

.site-title a {
  color: inherit;
  text-decoration: none;
}

.site-subtitle {
  margin: 0.55rem 0 0;
  color: var(--muted);
}

.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-list-item {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  align-items: baseline;
  gap: 1.25rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--faint);
}

.post-list-item:first-child {
  border-top: 1px solid var(--faint);
}

.post-list-date,
.post-header time {
  color: var(--muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.post-list-link {
  color: var(--foreground);
  font-size: 1.05rem;
  font-weight: 560;
  line-height: 1.55;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.post-list-link:hover {
  color: var(--accent);
}

.empty-state {
  color: var(--muted);
}

.pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  margin-top: 2.5rem;
  font-size: 0.9rem;
}

.pagination a {
  color: var(--muted);
  text-decoration: none;
}

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

.pagination-next {
  justify-self: end;
}

.pagination-status {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.back-nav {
  margin-bottom: 3.5rem;
  font-size: 0.9rem;
}

.back-nav a,
.post-footer a {
  color: var(--muted);
  text-decoration: none;
}

.back-nav a:hover,
.post-footer a:hover {
  color: var(--accent);
}

.post-header {
  margin-bottom: 3rem;
}

.post-header h1 {
  margin: 0 0 0.65rem;
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.post-content {
  font-family: Georgia, "Noto Serif SC", "Songti SC", SimSun, serif;
  font-size: 1.075rem;
}

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

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

.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  margin: 2.5em 0 0.75em;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.35;
}

.post-content h2 {
  font-size: 1.5rem;
}

.post-content h3 {
  font-size: 1.25rem;
}

.post-content h4,
.post-content h5,
.post-content h6 {
  font-size: 1.05rem;
}

.post-content p,
.post-content ul,
.post-content ol,
.post-content blockquote,
.post-content pre,
.post-content figure {
  margin: 1.35em 0;
}

.post-content ul,
.post-content ol {
  padding-left: 1.6em;
}

.post-content li + li {
  margin-top: 0.3em;
}

.post-content blockquote {
  margin-left: 0;
  padding-left: 1.15rem;
  border-left: 3px solid var(--quote-border);
  color: var(--muted);
}

.post-content blockquote > :first-child {
  margin-top: 0;
}

.post-content blockquote > :last-child {
  margin-bottom: 0;
}

.post-content code,
.post-content pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.post-content :not(pre) > code {
  padding: 0.15em 0.35em;
  border-radius: 3px;
  background: var(--code-background);
}

.post-content pre,
.post-content .highlight {
  overflow-x: auto;
  border: 1px solid var(--faint);
  border-radius: 6px;
  background: var(--code-background);
  -webkit-overflow-scrolling: touch;
}

.post-content pre {
  padding: 1rem 1.15rem;
  line-height: 1.65;
  tab-size: 4;
  -moz-tab-size: 4;
}

.post-content .highlight {
  margin: 1.35em 0;
}

.post-content .highlight table {
  width: 100%;
  border-collapse: collapse;
}

.post-content .highlight .gutter {
  display: none;
}

.post-content .highlight .code {
  width: 100%;
}

.post-content .highlight pre {
  margin: 0;
  border: 0;
  border-radius: 0;
}

.post-content img {
  display: block;
  width: 100%;
  height: auto;
  margin: 2rem 0;
  border-radius: 4px;
}

.post-content hr {
  margin: 3rem 0;
  border: 0;
  border-top: 1px solid var(--faint);
}

.post-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--faint);
  font-size: 0.9rem;
}

@media (max-width: 36rem) {
  .site-shell {
    width: min(calc(100% - 2rem), var(--content-width));
    padding-top: 3rem;
  }

  .site-header,
  .back-nav {
    margin-bottom: 2.5rem;
  }

  .post-list-item {
    grid-template-columns: 1fr;
    gap: 0.15rem;
    padding: 0.95rem 0;
  }

  .post-header {
    margin-bottom: 2.25rem;
  }

  .post-header h1 {
    font-size: 2rem;
  }

  .pagination {
    gap: 0.5rem;
  }

  .post-content {
    font-size: 1rem;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #151818;
    --foreground: #e5e8e8;
    --muted: #a1aaaa;
    --faint: #343b3b;
    --accent: #5bc6bd;
    --accent-hover: #8ddbd4;
    --code-background: #202525;
    --quote-border: #657171;
  }
}

@media print {
  .site-shell {
    width: 100%;
    padding: 0;
  }

  .back-nav,
  .post-footer {
    display: none;
  }

  a {
    color: inherit;
  }
}
