:root {
  --bg: #fbfbfd;
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.08);
  --accent: #007aff;
  --code-bg: #f5f5f7;
  --max-width: 720px;
}

[data-theme="dark"] {
  --bg: #000000;
  --fg: #f5f5f7;
  --muted: #a1a1a6;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #0a84ff;
  --code-bg: #1c1c1e;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue",
    Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: rgba(251, 251, 253, 0.72);
  border-bottom: 0.5px solid var(--line);
}

[data-theme="dark"] .site-header {
  background: rgba(0, 0, 0, 0.72);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}

.site-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-decoration: none;
  transition: opacity 0.2s;
}

.site-title:hover { opacity: 0.7; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.theme-toggle:hover {
  color: var(--fg);
  background: var(--line);
}

/* Main */
main {
  padding-top: 104px;
  padding-bottom: 96px;
  min-height: calc(100vh - 52px - 120px);
}

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

.post-item {
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}

.post-item:last-child { border-bottom: none; }

.post-item h2 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.post-item h2 a {
  display: inline;
  color: var(--fg);
  text-decoration: none;
  transition: color 0.2s;
}

.post-item h2 a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.post-item h2 a::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 10px;
  background-color: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20fill='%23000'%20d='M6%202h8l6%206v12a2%202%200%200%201-2%202H6a2%202%200%200%201-2-2V4a2%202%200%200%201%202-2zm8%201.5V9h5.5L14%203.5z'/%3E%3C/svg%3E") no-repeat center / contain;
          mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20fill='%23000'%20d='M6%202h8l6%206v12a2%202%200%200%201-2%202H6a2%202%200%200%201-2-2V4a2%202%200%200%201%202-2zm8%201.5V9h5.5L14%203.5z'/%3E%3C/svg%3E") no-repeat center / contain;
  vertical-align: -0.32em;
}

.post-item,
.post-item .desc,
.post-item .date { cursor: default; }

.post-item .desc {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.post-item .date {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

/* Pager */
.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 44px;
}

.pager button,
.pager .pager-current {
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1;
}

.pager button {
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.pager button:hover:not(:disabled) {
  background: var(--line);
  color: var(--fg);
}

.pager .pager-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: default;
}

.pager button:disabled {
  opacity: 0.35;
  cursor: default;
}

.pager-ellipsis {
  color: var(--muted);
  padding: 0 2px;
  user-select: none;
}

/* Post view */
.post h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0 0 10px;
}

.post .meta {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 40px;
}

.post-content { font-size: 17px; line-height: 1.75; }

.post-content p { margin: 0 0 1.25em; }

.post-content h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 2em 0 0.6em;
}

.post-content h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 1.8em 0 0.5em;
}

.post-content a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.15s;
}

.post-content a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-content ul,
.post-content ol {
  margin: 0 0 1.25em;
  padding-left: 1.5em;
}

.post-content li { margin: 0.35em 0; }

.post-content blockquote {
  margin: 0 0 1.25em;
  padding: 0.6em 1.2em;
  border-left: 4px solid var(--line);
  color: var(--muted);
}

.post-content code {
  background: var(--code-bg);
  padding: 0.2em 0.45em;
  border-radius: 8px;
  font-size: 0.88em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.post-content pre {
  background: var(--code-bg);
  padding: 20px;
  border-radius: 14px;
  overflow-x: auto;
  margin: 0 0 1.25em;
}

.post-content pre code { background: none; padding: 0; }

.post-content img { max-width: 100%; border-radius: 14px; }

.post-content hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2em 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  margin-bottom: 32px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

.back-link:hover { color: var(--fg); }

/* Footer */
.site-footer {
  border-top: 0.5px solid var(--line);
  padding: 28px 0 40px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.01em;
}

.site-footer .wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.footer-line,
.footer-link {
  display: block;
  line-height: 1.6;
}

.footer-link {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

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

.empty {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

/* Responsive */
@media (max-width: 640px) {
  .wrap { padding: 0 20px; }
  .site-title { font-size: 17px; }
  main { padding-top: 80px; padding-bottom: 72px; }
  .post-item h2 { font-size: 22px; }
  .post-item h2 a::before { width: 18px; height: 18px; margin-right: 8px; }
  .pager button,
  .pager .pager-current { min-width: 34px; height: 34px; font-size: 14px; }
  .post h1 { font-size: 28px; }
  .post-content { font-size: 16px; }
}
