:root {
  color-scheme: light;
  --page: #f7f7f4;
  --surface: #ffffff;
  --surface-soft: #f0f0eb;
  --text: #242424;
  --muted: #71736d;
  --line: #deded6;
  --line-strong: #c6c6bc;
  --accent: #2f5139;
  --accent-soft: #eef4ec;
  --shadow: 0 18px 48px rgba(28, 30, 24, 0.08);
  --radius: 6px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

body.dark {
  color-scheme: dark;
  --page: #11120f;
  --surface: #181914;
  --surface-soft: #20221d;
  --text: #f0efe9;
  --muted: #aaa99f;
  --line: #34362f;
  --line-strong: #494c42;
  --accent: #adc89d;
  --accent-soft: #1f291d;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--text);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
  min-width: 0;
  max-width: 100%;
}

.progress {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 60;
  width: 0%;
  height: 2px;
  background: var(--accent);
}

.reading-meter {
  position: fixed;
  top: 96px;
  right: max(18px, calc((100vw - 1120px) / 2 - 58px));
  z-index: 55;
  min-width: 42px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
  backdrop-filter: blur(12px);
}

.back-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 55;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease, border-color 180ms ease;
}

.back-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-top:hover {
  border-color: var(--accent);
}

.toc-fab {
  position: fixed;
  left: 18px;
  bottom: 22px;
  z-index: 72;
  min-width: 54px;
  height: 40px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: #242424;
  color: #f6f6f2;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toc-fab[hidden],
.article-drawer[hidden] {
  display: none;
}

body.has-article-drawer.article-drawer-closed .toc-fab {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.article-drawer {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 71;
  display: grid;
  width: min(360px, 88vw);
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 34px 28px 30px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: #232323;
  color: #aaa;
  box-shadow: 18px 0 44px rgba(0, 0, 0, 0.18);
  transform: translateX(0);
  transition: transform 240ms ease;
}

body.article-drawer-closed .article-drawer {
  transform: translateX(-100%);
}

.drawer-tabs {
  display: flex;
  gap: 18px;
  margin-bottom: 30px;
}

.drawer-tabs button {
  padding: 0 0 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #777;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 720;
}

.drawer-tabs button.active {
  border-bottom-color: #79d3ff;
  color: #79d3ff;
}

.drawer-panel {
  display: none;
  min-height: 0;
  overflow: auto;
}

.drawer-panel.active {
  display: block;
}

.drawer-toc {
  display: grid;
  gap: 2px;
}

.drawer-toc a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #9c9c9c;
  font-size: 1rem;
  line-height: 1.35;
}

.drawer-toc a:hover,
.drawer-toc a.active {
  color: #79d3ff;
}

.drawer-toc .toc-level-3 {
  padding-left: 18px;
  font-size: 0.92rem;
}

.toc-number {
  color: inherit;
  font-variant-numeric: tabular-nums;
}

.drawer-overview {
  display: grid;
  gap: 20px;
}

.drawer-author strong,
.drawer-overview li strong,
.drawer-stats strong {
  color: #f3f3ee;
}

.drawer-author p {
  margin: 8px 0 0;
  line-height: 1.75;
}

.drawer-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.drawer-stats span {
  display: grid;
  gap: 4px;
  padding: 12px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  text-align: center;
}

.drawer-overview ul {
  display: grid;
  gap: 14px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.drawer-overview li {
  line-height: 1.65;
}

.drawer-overview li strong {
  display: block;
}

.drawer-close {
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  color: #f3f3ee;
  cursor: pointer;
  font-size: 2rem;
  line-height: 1;
  text-align: left;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, transparent 0 82px, color-mix(in srgb, var(--line) 42%, transparent) 82px 83px),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 56%, transparent), transparent 42%);
  mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent);
  opacity: 0.28;
}

.site-shell {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 22px;
  align-items: center;
  min-height: 84px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--page) 92%, transparent);
  backdrop-filter: blur(14px);
}

.site-title {
  display: inline-block;
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  font-size: 1.42rem;
  font-weight: 650;
}

.site-title-block p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
  min-width: 0;
}

.site-nav a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 0 10px;
  border-radius: var(--radius);
  color: var(--muted);
}

.site-nav a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.pill-button,
.theme-button {
  display: grid;
  min-width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease, background 180ms ease;
}

.pill-button {
  padding: 0 10px;
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
}

.theme-button {
  width: 38px;
  border-radius: 50%;
}

.pill-button:hover,
.theme-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: 48px;
  align-items: start;
  padding: 46px 0 34px;
}

body.has-article-drawer .page-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

body.has-article-drawer .sidebar {
  display: none;
}

body.has-article-drawer .search-row {
  display: none;
}

.content {
  min-width: 0;
}

.home-hero {
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.page-label,
.section-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 16px;
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  font-size: 3.2rem;
  font-weight: 520;
  line-height: 1.07;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h2 {
  margin-bottom: 14px;
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  font-size: 2rem;
  font-weight: 520;
  line-height: 1.18;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 1.08rem;
  line-height: 1.42;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.home-description,
.section-head p,
.feed-post p,
.post-row p,
.archive-post p,
.about-page p {
  color: var(--muted);
  line-height: 1.82;
}

.home-description {
  max-width: 720px;
  margin-bottom: 0;
}

.home-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 20px;
  color: var(--muted);
}

.home-summary strong {
  color: var(--text);
}

.search-row {
  min-width: 0;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.search-field {
  display: flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.search-field span {
  color: var(--accent);
}

.search-field input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.section-block {
  padding: 34px 0 10px;
}

.section-head {
  padding-bottom: 18px;
}

.section-head p:not(.section-kicker) {
  max-width: 720px;
  margin-bottom: 0;
}

.post-feed {
  display: grid;
  gap: 22px;
}

.feed-post,
.post-row {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.feed-post:hover,
.post-row:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: 0 22px 52px rgba(28, 30, 24, 0.1);
}

.feed-post h3 {
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  font-size: 1.62rem;
  font-weight: 520;
}

.feed-post h3 a:hover,
.post-row h3 a:hover,
.archive-post a:hover,
.article-footer a:hover {
  color: var(--accent);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.post-row {
  display: grid;
  align-content: start;
  min-height: 242px;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.post-meta span + span::before,
.post-meta a::before {
  margin-right: 8px;
  content: "/";
  color: var(--line-strong);
}

.post-card-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  color: var(--muted);
  font-size: 0.88rem;
}

.post-tags a {
  color: var(--accent);
}

.read-more,
.article-footer a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--accent);
}

.read-more:hover,
.article-footer a:hover {
  border-color: var(--accent);
}

.archive-list {
  display: grid;
  gap: 34px;
}

.archive-year {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 26px;
}

.archive-year h2 {
  position: sticky;
  top: 106px;
  margin: 0;
}

.year-posts {
  display: grid;
  border-top: 1px solid var(--line);
}

.archive-post {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 18px;
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
}

.archive-date {
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
}

.archive-post a {
  font-weight: 720;
}

.archive-post p {
  margin: 7px 0 0;
  font-size: 0.94rem;
}

.taxonomy-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.taxonomy-card {
  display: grid;
  min-height: 132px;
  align-content: start;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.taxonomy-card strong {
  font-size: 1.08rem;
}

.taxonomy-card span {
  margin: 8px 0;
  color: var(--accent);
}

.taxonomy-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

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

.tag-cloud a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
}

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

.article-view {
  min-width: 0;
  padding: 34px 0 10px;
}

.article-header {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

body.has-article-drawer .article-view {
  padding-top: 62px;
}

body.has-article-drawer .article-view.reveal {
  opacity: 1;
  transform: none;
}

body.has-article-drawer .article-header {
  display: grid;
  justify-items: center;
  padding: 70px 0 58px;
  text-align: center;
}

body.has-article-drawer .article-header h1 {
  max-width: 860px;
  font-size: clamp(2.35rem, 5vw, 3.5rem);
}

body.has-article-drawer .article-header .post-meta {
  justify-content: center;
}

.article-body {
  width: 100%;
  max-width: 760px;
  padding: 28px 0;
  color: var(--text);
}

body.has-article-drawer .article-body,
body.has-article-drawer .article-footer {
  max-width: 860px;
  margin-right: auto;
  margin-left: auto;
}

.article-body h1,
.article-body h2,
.article-body h3 {
  margin-top: 1.35em;
  scroll-margin-top: 112px;
}

.article-body p,
.article-body li {
  color: color-mix(in srgb, var(--text) 78%, var(--muted));
  font-size: 1rem;
  line-height: 1.95;
}

.article-body ul {
  padding-left: 1.3rem;
}

.article-body blockquote {
  margin: 24px 0;
  padding: 12px 18px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
}

.article-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.about-page {
  max-width: 760px;
}

.empty {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

.sidebar {
  position: sticky;
  top: 108px;
  display: grid;
  gap: 16px;
}

.sidebar-block {
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.article-toc-block {
  max-height: calc(100vh - 132px);
  overflow: auto;
}

.toc-list {
  display: grid;
  gap: 8px;
}

.toc-list a {
  display: block;
  padding: 6px 0 6px 10px;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.toc-list a:hover,
.toc-list a.active {
  border-left-color: var(--accent);
  color: var(--accent);
}

.toc-level-3 {
  margin-left: 12px;
  font-size: 0.84rem;
}

.author-block {
  position: relative;
  padding: 0 18px 21px;
  text-align: center;
  overflow: hidden;
}

.author-block::before {
  position: absolute;
  inset: 0 0 auto;
  z-index: 1;
  height: 124px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), color-mix(in srgb, var(--surface) 12%, transparent));
  content: "";
  pointer-events: none;
}

.author-cover {
  display: block;
  width: calc(100% + 36px);
  height: 124px;
  margin: 0 -18px;
  object-fit: cover;
  object-position: center 48%;
  filter: saturate(0.62) contrast(0.94) brightness(1.05);
  opacity: 0.94;
}

.avatar {
  position: relative;
  z-index: 2;
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  margin: -34px auto 15px;
  border: 4px solid var(--surface);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 96%, var(--accent));
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.48rem;
  line-height: 1;
  box-shadow: 0 12px 28px rgba(28, 30, 24, 0.12), inset 0 0 0 1px var(--line-strong);
}

.author-block h2,
.sidebar-block h2 {
  margin-bottom: 10px;
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  font-size: 1.08rem;
  font-weight: 620;
}

.author-block p {
  position: relative;
  z-index: 2;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.75;
}

.author-block h2 {
  position: relative;
  z-index: 2;
  margin-bottom: 8px;
  font-size: 1.2rem;
}

.stat-block {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  padding: 0;
  overflow: hidden;
}

.stat-block a {
  display: grid;
  min-height: 70px;
  place-items: center;
  background: var(--surface);
}

.stat-block strong {
  font-size: 1.2rem;
}

.stat-block span {
  color: var(--muted);
  font-size: 0.82rem;
}

.side-list {
  display: grid;
  gap: 10px;
}

.side-list a {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  color: var(--muted);
  line-height: 1.48;
}

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

.side-list em {
  color: var(--accent);
  font-style: normal;
}

.now-list {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.now-list li {
  color: var(--muted);
  line-height: 1.65;
}

.now-list strong {
  display: block;
  color: var(--text);
}

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

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

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 520ms ease, transform 520ms ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 1080px) {
  body.has-article-drawer:not(.article-drawer-closed) .site-shell {
    width: min(1040px, calc(100% - 420px));
    margin-right: 32px;
    margin-left: 388px;
  }
}

@media (max-width: 940px) {
  .site-header {
    grid-template-columns: 1fr auto;
    gap: 12px;
    min-height: 78px;
    padding-top: 10px;
  }

  .site-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-bottom: 12px;
  }

  .page-grid {
    grid-template-columns: 1fr;
    padding-top: 34px;
  }

  .sidebar {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .author-block,
  .stat-block {
    grid-column: 1 / -1;
  }

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

  .reading-meter {
    display: none;
  }
}

@media (max-width: 620px) {
  .site-shell {
    width: min(620px, calc(100% - 42px));
  }

  .site-header {
    grid-template-columns: 1fr;
  }

  .site-title-block {
    padding-right: 86px;
  }

  .site-title-block p {
    display: none;
  }

  .site-nav {
    max-width: 100%;
    flex-wrap: nowrap;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .site-nav::-webkit-scrollbar {
    display: none;
  }

  .site-nav a {
    flex: 0 0 auto;
    padding: 0 8px;
  }

  .header-actions {
    position: absolute;
    top: 15px;
    right: 0;
    gap: 6px;
  }

  .pill-button,
  .theme-button {
    min-width: 36px;
    height: 36px;
  }

  h1 {
    max-width: 7.5em;
    font-size: 2.12rem;
    word-break: break-all;
  }

  body.has-article-drawer .article-view {
    padding-top: 18px;
  }

  body.has-article-drawer .article-header {
    padding: 48px 0 42px;
  }

  body.has-article-drawer .article-header h1 {
    max-width: 8.6em;
    font-size: 2.08rem;
    word-break: break-all;
  }

  .home-description,
  .feed-post p,
  .post-row p,
  .archive-post p,
  .article-body p,
  .article-body li,
  .now-list li {
    overflow-wrap: anywhere;
    word-break: break-all;
  }

  body.has-article-drawer .article-body p,
  body.has-article-drawer .article-body li {
    overflow-wrap: anywhere;
    word-break: break-all;
  }

  h2 {
    font-size: 1.72rem;
  }

  .feed-post,
  .post-row {
    width: 100%;
    min-width: 0;
    padding: 20px;
  }

  .feed-post h3 {
    font-size: 1.36rem;
    word-break: break-all;
  }

  .post-card-bottom,
  .article-footer,
  .site-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .read-more,
  .article-footer a {
    justify-content: center;
    width: 100%;
  }

  .archive-year {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .archive-year h2 {
    position: static;
  }

  .archive-post {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 12px;
  }

  .taxonomy-list,
  .sidebar {
    grid-template-columns: 1fr;
  }
}
