:root {
  --color-background: #e2e0de;
  --color-text: #363533;
  --color-muted: #625f5b;
  --color-link: #177653;
  --color-accent: #b52f60;
  --color-quote: #8f2043;
  --color-code: #292827;
  --font-body: "Menlo", "Meslo LG", "SFMono-Regular", Consolas, "Liberation Mono", "PingFang SC", "Microsoft YaHei", monospace;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  min-height: 100%;
  border-top: 2px solid var(--color-text);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  margin: 0;
  color: var(--color-text);
  background: var(--color-background);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.site-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.width { width: 100%; max-width: 39rem; }
.px3 { padding-left: var(--space-6); padding-right: var(--space-6); }
.my4 { margin-top: var(--space-8); margin-bottom: var(--space-12); }
main { flex: 1; margin-left: auto; margin-right: auto; }

a {
  color: var(--color-text);
  text-decoration: none;
  background-image: linear-gradient(transparent, transparent calc(100% - 1px), var(--color-text) calc(100% - 1px));
  transition: color 160ms ease-out, background-color 160ms ease-out;
}
a:hover { background-image: linear-gradient(transparent, transparent calc(100% - 2px), var(--color-link) calc(100% - 2px)); color: var(--color-link); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--color-link); outline-offset: 4px; }

h1, h2, h3, h4, h5, h6 { line-height: 1.35; }
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { background: none; color: inherit; }
p { margin: 0 0 var(--space-6); }
img, video { display: block; max-width: 100%; height: auto; margin: var(--space-4) auto; }
ul, ol { padding-left: 1.5rem; }

#header { max-width: 710px; width: 100%; margin: var(--space-8) auto var(--space-12); }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.brand { display: inline-flex; align-items: center; gap: 20px; color: inherit; background: none; min-height: 50px; }
#logo { width: 50px; height: 50px; margin: 0; border-radius: 5px; filter: grayscale(100%); transition: filter 180ms ease-out; }
.brand:hover #logo { filter: none; }
#title { font-size: 1.5rem; line-height: 2rem; font-weight: 700; letter-spacing: 0.01em; }
#nav { margin-top: var(--space-2); color: var(--color-accent); font-size: 0.875rem; }
.nav-list { display: flex; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.nav-list li { display: flex; align-items: center; }
.nav-list li:not(:last-child)::after { content: ""; height: 1em; margin: 0 15px; border-right: 1px dotted var(--color-accent); }
.nav-list a { display: inline-flex; align-items: center; min-height: 44px; color: var(--color-accent); background: none; }
.nav-list a:hover, .nav-list a[aria-current="page"] { background-image: linear-gradient(transparent, transparent calc(100% - 2px), var(--color-accent) calc(100% - 2px)); }
.nav-toggle { display: none; min-width: 44px; min-height: 44px; padding: 0; border: 0; color: var(--color-accent); background: transparent; font: inherit; cursor: pointer; }

section { margin-bottom: var(--space-12); }
.section-title { margin: 0 0 var(--space-4); font-size: 1.5rem; }
.social-line { display: flex; flex-wrap: wrap; gap: 0 0.35rem; margin-bottom: var(--space-6); }
#sociallinks { display: inline-flex; flex-wrap: wrap; gap: 0 0.35rem; list-style: none; padding: 0; margin: 0; }
#sociallinks li { display: inline; }
#sociallinks li:not(:last-child)::after { content: ","; }
.meta { color: var(--color-muted); font-size: 0.875rem; }

.post-list { padding: 0; margin: 0; }
.post-item { list-style: none; margin: 0 0 var(--space-4); }
.post-item .meta { display: block; min-width: 110px; margin-right: var(--space-4); }
.post-item a { overflow-wrap: anywhere; }
.project-list { padding: 0; list-style: none; }
.project-item { margin-bottom: var(--space-2); }
.empty { list-style: none; color: var(--color-muted); }

.posttitle { margin: 0; font-size: 1.65rem; line-height: 1.3; overflow-wrap: anywhere; }
.article-meta { margin: var(--space-2) 0 var(--space-8); }
.author { font-weight: 700; letter-spacing: 0.01em; }
.article-tag { display: block; margin-top: var(--space-1); }
.article-tag::before { content: "Tags: "; }
.tag-link { margin-right: var(--space-2); background: none; color: var(--color-muted); }
.tag-link::before { content: "#"; }
.article-content { overflow-wrap: anywhere; }
.article-content h2 { position: relative; margin-top: var(--space-8); }
.article-content h2::before { content: "#"; position: absolute; left: -1.1rem; color: var(--color-accent); font-weight: 700; }
.article-content a { text-decoration: none; }
.article-content blockquote { margin: var(--space-4) 10px; padding: var(--space-2) 10px; color: var(--color-quote); }
.article-content blockquote p:last-child { margin-bottom: 0; }
.article-content hr { margin: var(--space-8) 0; border: 0; border-top: 1px dotted var(--color-muted); }
.article-content table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; }
.article-content th, .article-content td { padding: var(--space-2); border-bottom: 1px dotted var(--color-muted); text-align: left; }
.toc { margin: var(--space-6) 0; padding: var(--space-4) 0; border-top: 1px dotted var(--color-muted); border-bottom: 1px dotted var(--color-muted); }
.toc ul { margin: var(--space-2) 0 0; }
.section-content { margin-bottom: var(--space-8); }
.archive-year { margin: var(--space-8) 0 var(--space-4); font-size: 1.2rem; color: var(--color-accent); }
.term-list { list-style: none; padding: 0; }
.term-list li { display: flex; gap: var(--space-3); align-items: baseline; }
.term-list .meta { margin-left: auto; }

pre, code { font-family: var(--font-body); font-size: 0.875rem; }
code { padding: 0.1em 0.35em; border: 1px dotted #666; border-radius: 2px; }
pre { padding: 15px; border: 1px dotted #666; border-radius: 4px; overflow-x: auto; line-height: 1.55; }
pre code { display: block; padding: 0; border: 0; background: transparent; }
.highlight { margin: var(--space-4) 0; border-radius: 4px; }
.highlight pre { border: 0; }

.pagination { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); margin-top: var(--space-8); font-size: 0.875rem; }
.pagination > span:not(.page-number) { color: var(--color-muted); }
.page-number { color: var(--color-muted); }

#footer { width: 100%; max-width: 700px; margin: 0 auto var(--space-4); padding-top: var(--space-4); color: var(--color-muted); font-size: 0.75rem; text-align: center; }
.footer-main { display: flex; flex-direction: column; gap: var(--space-2); }
#footer ul { display: flex; flex-wrap: wrap; justify-content: center; margin: 0; padding: 0; list-style: none; }
#footer li { display: flex; align-items: center; }
#footer li:not(:last-child)::after { content: ""; height: 1em; margin: 0 12px; border-right: 1px solid var(--color-muted); }
#footer a { display: inline-flex; align-items: center; min-height: 32px; color: var(--color-muted); background: none; }
#footer a:hover { color: var(--color-link); }
.beian { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 var(--space-4); margin-top: var(--space-2); }
.powered { margin-top: var(--space-1); }

@media (min-width: 480px) {
  .article-content p { text-align: justify; }
  .post-item { display: flex; margin-bottom: var(--space-1); }
  .article-tag { display: inline; margin-left: var(--space-2); }
  .article-tag::before { content: "· "; }
  .footer-main { flex-direction: row; justify-content: space-between; text-align: left; }
}

@media (max-width: 480px) {
  .px3 { padding-left: var(--space-4); padding-right: var(--space-4); }
  .my4 { margin-top: var(--space-8); margin-bottom: var(--space-8); }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .js .nav-list { display: none; }
  .js .nav-list.is-open { display: block; padding-top: var(--space-2); }
  .nav-list li { display: block; }
  .nav-list li:not(:last-child)::after { display: none; }
  .nav-list a { width: 100%; }
  .article-content h2::before { position: static; margin-right: var(--space-2); }
  .pagination { flex-wrap: wrap; }
}

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