@font-face {
  font-family: "LXGW Display";
  src: url("/fonts/LXGWWenKai/LXGWWenKai-Display.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f4efe5;
  --paper-deep: #ebe3d5;
  --surface: rgba(255, 252, 245, 0.82);
  --surface-solid: #fffaf0;
  --surface-muted: #eee6d8;
  --ink: #26231d;
  --ink-soft: #595246;
  --muted: #80776a;
  --line: rgba(84, 72, 55, 0.18);
  --accent: #2d6864;
  --accent-strong: #164d49;
  --seal: #a74d3f;
  --code-bg: #1c211d;
  --code-ink: #edf3ed;
  --shadow: 0 18px 50px rgba(48, 37, 24, 0.09);
  --shadow-hover: 0 24px 70px rgba(48, 37, 24, 0.14);
  --radius: 8px;
  --content: min(1120px, calc(100vw - 48px));
  --article: min(760px, calc(100vw - 48px));
  --display-font: "LXGW Display", "STKaiti", "KaiTi", "Kaiti SC", serif;
  --body-font: "LXGW Display", "LXGW WenKai", "LXGW WenKai Screen", "Iowan Old Style", "Noto Serif CJK SC", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  --sans-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans CJK SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --code-font: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171b1a;
    --paper-deep: #111413;
    --surface: rgba(33, 38, 35, 0.82);
    --surface-solid: #202622;
    --surface-muted: #252d28;
    --ink: #eee8dc;
    --ink-soft: #c9c0b2;
    --muted: #9f978c;
    --line: rgba(229, 220, 204, 0.14);
    --accent: #8ccac1;
    --accent-strong: #b8e5df;
    --seal: #d07967;
    --code-bg: #0f1211;
    --code-ink: #eff5ee;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    --shadow-hover: 0 24px 70px rgba(0, 0, 0, 0.38);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--body-font);
  line-height: 1.86;
  letter-spacing: 0;
  background:
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 34rem),
    radial-gradient(circle at 82% 12%, color-mix(in srgb, var(--seal) 12%, transparent), transparent 28rem),
    linear-gradient(180deg, var(--paper), var(--paper-deep));
  background-attachment: fixed;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.38;
  background-image:
    linear-gradient(90deg, rgba(120, 105, 80, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(120, 105, 80, 0.03) 1px, transparent 1px);
  background-size: 42px 42px;
}

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-underline-offset: 0.18em;
  transition: color 160ms ease, text-decoration-color 160ms ease, transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

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

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

.skip-link {
  position: absolute;
  left: 20px;
  top: -80px;
  z-index: 20;
  padding: 8px 12px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.skip-link:focus { top: 14px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(18px);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  border-bottom: 1px solid var(--line);
}

.nav {
  width: var(--content);
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  font-family: var(--sans-font);
}

.brand {
  font-family: var(--display-font);
  font-size: clamp(1.28rem, 2.2vw, 1.56rem);
  text-decoration: none;
  color: var(--ink);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 0.94rem;
}

.nav-menu a {
  position: relative;
  text-decoration: none;
  padding: 2px 0;
}

.nav-menu a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 160ms ease;
}

.nav-menu a:hover::after,
.nav-menu a.is-active::after { transform: scaleX(1); }

.nav-menu a.is-active { color: var(--ink); }

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 7px 10px;
  font: inherit;
}

.hero {
  width: var(--content);
  margin: 0 auto;
  padding: clamp(74px, 12vw, 136px) 0 clamp(44px, 7vw, 74px);
}

.hero-kicker {
  display: flex;
  align-items: center;
  gap: 14px;
  width: fit-content;
  color: var(--muted);
  font-family: var(--sans-font);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.hero-kicker::before {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--seal);
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--seal) 12%, transparent);
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: clamp(32px, 7vw, 88px);
  align-items: end;
  margin-top: 28px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-family: var(--sans-font);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.hero h1,
.page-head h1,
.article-head h1,
.not-found h1 {
  margin: 0;
  word-break: keep-all;
  font-family: var(--display-font);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: 0;
}

.hero h1 { font-size: clamp(3.6rem, 10vw, 8.2rem); }

.subtitle {
  max-width: 700px;
  margin: 24px 0 0;
  color: var(--ink-soft);
  font-family: var(--display-font);
  font-size: clamp(1.25rem, 2.6vw, 1.72rem);
  line-height: 1.72;
}

.hero-note {
  position: relative;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-note::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: calc(var(--radius) - 2px);
  pointer-events: none;
}

.hero-note p {
  margin: 0 0 12px;
  color: var(--accent);
  font-family: var(--display-font);
  font-size: 1.2rem;
}

.hero-note ul,
.topic-row,
.tag-list,
.archive-year ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

.hero-note li {
  padding: 8px 0;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
}

.section-wrap,
.page-head {
  width: var(--content);
  margin: 0 auto;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  border-top: 1px solid var(--line);
  padding-top: 30px;
}

.section-head.compact { margin-top: 54px; }

.section-head h2,
.archive-year h2 {
  margin: 0;
  font-family: var(--display-font);
  font-weight: 400;
  font-size: clamp(1.72rem, 3vw, 2.25rem);
  line-height: 1.2;
}

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

.post-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.post-card {
  position: relative;
  min-height: 286px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.post-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--seal) 72%, var(--accent)));
  opacity: 0.72;
}

.post-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  box-shadow: var(--shadow-hover);
}

.post-card h2 {
  margin: 0;
  font-family: var(--display-font);
  font-weight: 400;
  font-size: 1.58rem;
  line-height: 1.36;
}

.post-card h2 a { text-decoration: none; }

.post-card p {
  margin: 0;
  color: var(--ink-soft);
}

.post-meta,
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-family: var(--sans-font);
  font-size: 0.86rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-list a,
.term-cloud a {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-solid) 58%, transparent);
  text-decoration: none;
  font-family: var(--sans-font);
  font-size: 0.86rem;
}

.tag-list a:hover,
.term-cloud a:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}

.read-more,
.text-link {
  margin-top: auto;
  color: var(--accent);
  font-family: var(--sans-font);
  font-weight: 650;
  text-decoration: none;
}

.read-more:hover,
.text-link:hover { transform: translateY(-1px); }

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

.topic-row article {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 76%, transparent);
}

.topic-row span {
  color: var(--seal);
  font-family: var(--sans-font);
  font-size: 0.8rem;
}

.topic-row h3 {
  margin: 8px 0;
  font-family: var(--display-font);
  font-weight: 400;
  font-size: 1.5rem;
}

.topic-row p { margin: 0; color: var(--ink-soft); }

.page-head {
  padding: 74px 0 38px;
}

.page-head h1,
.not-found h1 { font-size: clamp(2.25rem, 6vw, 4.6rem); }

.lead {
  max-width: 720px;
  margin-top: 18px;
  color: var(--ink-soft);
}

.article {
  width: var(--article);
  margin: 0 auto;
  padding: 72px 0 42px;
}

.article-head {
  position: relative;
  margin-bottom: 34px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.article-head::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 74px;
  height: 3px;
  background: var(--seal);
}

.article-head h1 {
  font-size: clamp(2.25rem, 6vw, 4.8rem);
}

.article-meta {
  margin-top: 22px;
}

.toc {
  margin: 0 0 34px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 68%, transparent);
  font-family: var(--sans-font);
}

.toc p {
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 700;
}

.toc ul { margin: 0; padding-left: 1.2em; }

.prose {
  font-size: 1.08rem;
  line-height: 1.95;
}

.prose > * + * { margin-top: 1.18em; }

.prose h2,
.prose h3,
.prose h4 {
  margin-top: 2.35em;
  line-height: 1.38;
  font-family: var(--display-font);
  font-weight: 400;
}

.prose h2 { font-size: 1.95rem; }
.prose h3 { font-size: 1.48rem; }
.prose h4 { font-size: 1.18rem; }

.prose p { margin-bottom: 0; }

.prose a {
  color: var(--accent-strong);
  text-decoration-thickness: 1px;
}

.prose blockquote {
  position: relative;
  margin-left: 0;
  padding: 16px 20px 16px 24px;
  border-left: 3px solid var(--seal);
  background: color-mix(in srgb, var(--surface) 66%, transparent);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--ink-soft);
  font-family: var(--display-font);
  font-size: 1.12rem;
}

.prose ul,
.prose ol { padding-left: 1.35em; }

.prose li + li { margin-top: 0.35em; }

.prose hr {
  border: 0;
  height: 1px;
  margin: 2.4em 0;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

.prose code {
  padding: 0.12em 0.35em;
  border-radius: 5px;
  background: var(--surface-muted);
  font-family: var(--code-font);
  font-size: 0.9em;
}

.prose pre {
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-ink);
  line-height: 1.65;
}

.prose pre code { padding: 0; background: transparent; }

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.prose figure { margin: 2em 0; }

.prose figcaption {
  margin-top: 0.6em;
  color: var(--muted);
  text-align: center;
  font-family: var(--sans-font);
  font-size: 0.88rem;
}

.prose table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.prose th,
.prose td {
  padding: 10px 12px;
  border: 1px solid var(--line);
}

.prose th {
  background: var(--surface-muted);
}

.article-foot {
  margin-top: 46px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.post-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.post-nav a {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
}

.archive-year {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 24px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
}

.archive-year h2 {
  color: var(--accent);
}

.archive-year li {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 18px;
  padding: 10px 0;
}

.archive-year a { text-decoration: none; }

.archive-year time,
.muted { color: var(--muted); }

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

.pagination {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 28px;
  font-family: var(--sans-font);
  color: var(--muted);
}

.not-found {
  width: var(--article);
  min-height: 58vh;
  margin: 0 auto;
  padding: 96px 0;
}

.not-found p {
  color: var(--ink-soft);
}

.not-found-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 26px;
}

.site-footer {
  width: var(--content);
  margin: 78px auto 0;
  padding: 30px 0 44px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-family: var(--sans-font);
}

.site-footer p { margin: 0; }

.footer-note { font-size: 0.88rem; }

@media (max-width: 900px) {
  :root {
    --content: min(100vw - 30px, 1120px);
    --article: min(100vw - 30px, 760px);
  }

  .hero-layout,
  .post-grid,
  .post-list,
  .topic-row { grid-template-columns: 1fr; }

  .hero-note { max-width: 420px; }

  .post-card { min-height: 0; }
}

@media (max-width: 720px) {
  .nav { min-height: 60px; }

  .nav-toggle { display: inline-flex; }

  .nav-menu {
    position: absolute;
    inset: 60px 15px auto 15px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px;
    background: var(--surface-solid);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }

  .nav-menu.is-open { display: flex; }

  .nav-menu a { padding: 10px 12px; }
  .nav-menu a::after { display: none; }

  .hero { padding-top: 58px; }

  .hero h1 { font-size: clamp(2.86rem, 16vw, 4.8rem); }

  .section-head,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .post-nav { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }

  .post-card:hover,
  .read-more:hover,
  .text-link:hover { transform: none; }
}
