:root {
  /* Palette and typography from DouBan-FE/vendors douban.css and core/reset.css. */
  --ink: #111111;
  --ink-soft: #494949;
  --muted: #666666;
  --faint: #999999;
  --link: #3377aa;
  --link-visited: #666699;
  --link-active: #ff9933;
  --green: #007722;
  --green-dark: #006600;
  --green-soft: #f2fbf2;
  --border: #eeeeee;
  --border-strong: #dddddd;
  --paper: #ffffff;
  --canvas: #ffffff;
  --surface: #f4f4f4;
  --max-width: 1120px;
  --font-sans: Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.62;
}

::selection {
  background: rgba(51, 119, 170, 0.16);
}

a {
  color: var(--link);
  text-decoration: none;
}

a:visited { color: var(--link-visited); }
a:hover { color: var(--paper); background: var(--link); }
a:active { color: var(--paper); background: var(--link-active); }

.brand:hover,
.brand:active,
a:has(> img):hover,
a:has(> img):active { background: none; }

img { max-width: 100%; height: auto; }

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 28px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(10px);
}

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

.brand img {
  display: block;
  height: 25px;
  width: auto;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  font-size: 14px;
}

.nav a {
  position: relative;
  color: var(--green);
  padding: 4px 0;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;
  height: 1px;
  background: var(--green);
  transition: right 0.2s ease;
}

.nav a:hover,
.nav a:active {
  color: var(--green);
  background: none;
}

.nav a:hover::after {
  right: 0;
}

.nav-external-mark { margin-left: 3px; font-size: 12px; }

/* Layout */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 252px;
  gap: 60px;
  padding-top: 46px;
  padding-bottom: 64px;
}

.main { min-width: 0; }

.sidebar {
  position: sticky;
  top: 96px;
  align-self: start;
  font-size: 12px;
}

/* Page heading */

.page-header {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.page-title {
  margin: 0;
  color: var(--ink-soft);
  font-size: 25px;
  font-weight: 700;
  line-height: 1.4;
}

.page-desc {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.02em;
}

/* Article list */

.post-summary {
  padding: 26px 0 24px;
  border-bottom: 1px solid var(--border);
}

.post-date {
  color: var(--faint);
  font-size: 12px;
  white-space: nowrap;
}

.post-summary > h2 {
  margin: 0 0 7px;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
}

.post-summary .entry { margin-top: 18px; }

.post-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
  letter-spacing: 0.01em;
}

.meta-sep {
  margin: 0 6px;
  color: var(--border-strong);
}

.meta-link {
  display: inline-block;
  margin-right: 8px;
}

/* Single post */

.post { min-width: 0; }

.post-header {
  position: relative;
  padding-bottom: 24px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--border);
}

.post-header::before {
  content: "";
  display: block;
  width: 30px;
  height: 2px;
  margin-bottom: 18px;
  background: var(--green);
}

.post-title {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-size: 25px;
  font-weight: 700;
  line-height: 1.4;
}

.entry {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.8;
  overflow-wrap: break-word;
}

.entry p { margin: 0 0 1.35em; }

.entry h2,
.entry h3,
.entry h4 {
  margin: 1.7em 0 0.7em;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.5;
}

.entry h2 { color: var(--green); font-size: 15px; }
.entry h3 { font-size: 14px; }
.entry h4 { font-size: 12px; }

.entry blockquote {
  margin: 1.5em 0;
  padding: 14px 20px;
  color: var(--muted);
  background: var(--green-soft);
  border-left: 3px solid var(--green);
}

.entry blockquote p:last-child { margin-bottom: 0; }

.entry pre {
  overflow-x: auto;
  padding: 15px 17px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
}

.entry code {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.entry img {
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(31, 35, 32, 0.08);
}

.entry img.aligncenter,
.entry p[style*="text-align: center"] > img,
.entry p[style*="text-align:center"] > img {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.entry a:has(> img.aligncenter),
.entry p[style*="text-align: center"] > a:has(> img),
.entry p[style*="text-align:center"] > a:has(> img) {
  display: block;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

.entry td pre {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  white-space: normal;
}

.entry .wp-caption {
  width: auto;
  max-width: 100%;
}

.entry .wp-caption a,
.entry .wp-caption a:has(> img.aligncenter) {
  display: block;
  width: 100%;
}

.entry .wp-caption img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
}

.entry .wp-caption-text {
  margin-top: 6px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 12px;
  text-align: center;
}

.entry img[align="left"] { float: left; margin: 4px 18px 14px 0; }
.entry img[align="right"] { float: right; margin: 4px 0 14px 18px; }
.entry::after { content: ""; display: block; clear: both; }

.entry table {
  max-width: 100%;
  margin: 1.2em 0;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 13px;
}

.entry th,
.entry td {
  padding: 7px 11px;
  border: 1px solid var(--border);
}

.entry th {
  background: var(--surface);
  font-weight: 600;
}

.post-tags {
  margin-top: 38px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.post-tags .meta-link {
  margin-right: 0;
  padding: 3px 9px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
}

.post-tags .meta-link:hover {
  border-color: var(--link);
}

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 42px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.post-nav .next { text-align: right; }

/* Sidebar */

.widget { margin-bottom: 34px; }

.widget h2 {
  position: relative;
  margin: 0 0 12px;
  padding-bottom: 10px;
  color: var(--green);
  font-size: 15px;
  font-weight: 400;
}

.widget h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 22px;
  height: 2px;
  background: var(--green);
}

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

.term-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border-strong);
}

.term-list li:last-child { border-bottom: 0; }

.count { color: var(--faint); font-size: 12px; }

.feed-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  line-height: 1.4;
}

.feed-link svg { flex: none; }

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-cloud a {
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 12px;
}

.tag-cloud a:hover {
  border-color: var(--link);
}

.search-form { display: flex; gap: 6px; }

.search-form input {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 3px;
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.search-form input:focus {
  border-color: var(--link);
  box-shadow: 0 0 0 3px rgba(51, 119, 170, 0.12);
}

.search-form button {
  padding: 7px 13px;
  color: #fff;
  background: var(--green);
  border: 1px solid var(--green);
  border-radius: 3px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.18s ease;
}

.search-form button:hover { background: var(--green-dark); }

.search-page-form { max-width: 620px; }
.search-page-form input { padding: 10px 13px; font-size: 15px; }
.search-page-form button { padding: 10px 20px; }

.search-status {
  margin: 20px 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.search-result {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.search-result h2 {
  margin: 0 0 5px;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
}

.search-meta {
  color: var(--faint);
  font-size: 12px;
}

.search-snippet {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.search-result mark {
  padding: 0 1px;
  color: inherit;
  background: #fff6ee;
}

/* Comments */

.comments {
  margin-top: 52px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.comments h2 {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 15px;
  font-weight: 400;
}

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

.comment {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.comment-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.comment-author {
  color: var(--muted);
  font-weight: 400;
}

.comment-meta time {
  color: var(--faint);
  font-size: 12px;
}

.comment-content {
  margin-top: 7px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.85;
  overflow-wrap: break-word;
}

.comment-content p { margin: 0 0 0.8em; }

.comments-closed {
  margin-top: 18px;
  color: var(--faint);
  font-size: 12px;
}

/* Pagination */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 34px 0 8px;
  font-size: 12px;
}

.pagination a {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
}

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

.page-info {
  color: var(--faint);
  font-size: 12px;
}

/* Footer */

.site-footer {
  margin-top: 20px;
  color: var(--faint);
  background: var(--paper);
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 22px;
  padding-bottom: 28px;
}

.footer-inner p { margin: 0; }

/* Lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 36px;
  background: rgba(20, 22, 20, 0.88);
}

.lightbox[hidden] { display: none; }

.lightbox-figure {
  margin: 0;
  max-width: 94vw;
  max-height: 90vh;
}

.lightbox-image {
  display: block;
  max-width: 94vw;
  max-height: 82vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  background: var(--surface);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

.lightbox-caption {
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.78);
  font: 12px/1.5 var(--font-sans);
  text-align: center;
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 22px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

.lightbox-link { cursor: zoom-in; }

html.lightbox-open,
html.lightbox-open body { overflow: hidden; }

@media (max-width: 640px) {
  .lightbox { padding: 16px; }
  .lightbox-close { top: 12px; right: 12px; }
  .lightbox-image { max-width: 94vw; max-height: 78vh; }
}

/* Responsive */

@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 36px;
    padding-top: 34px;
    padding-bottom: 48px;
  }

  .sidebar {
    position: static;
    padding-top: 26px;
    border-top: 1px solid var(--border);
  }

  .sidebar .widget:last-child { margin-bottom: 0; }
}

@media (max-width: 640px) {
  .container { padding: 0 20px; }

  .header-inner {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    padding-top: 13px;
    padding-bottom: 12px;
  }

  .nav { gap: 14px; }

  .post-summary { padding: 22px 0; }

  .post-title,
  .page-title { font-size: 22px; }
}
