:root {
  color-scheme: light;
  --paper: #fbf8f2;
  --ink: #172636;
  --muted: #53606a;
  --line: #e4dccf;
  --soft-paper: #f4eee3;
  --accent: #8e451f;
  --gold: #f2bd70;
  --display: Georgia, "Times New Roman", "Songti SC", "Noto Serif CJK SC", SimSun, serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.6 var(--sans);
}
main { flex: 1; }
a { color: inherit; text-underline-offset: .22em; }
a:hover { color: var(--accent); }
a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
h1, h2, h3, p { margin-block: 0; }
section[id], div[id], .prose :is(h1,h2,h3,h4,h5,h6) { scroll-margin-top: 1.5rem; }

.site-frame { width: min(1184px, calc(100% - 96px)); margin-inline: auto; }
.reading-frame { --reading-font-size: 1.21rem; width: min(760px, calc(100% - 64px)); margin: 72px auto 96px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; z-index: 2; top: -4rem; left: 1rem; padding: .5rem 1rem; color: var(--ink); background: var(--paper); }
.skip:focus { top: .5rem; }

.site-header { border-bottom: 1px solid var(--line); background: #fdfaf4; }
.header-inner, .footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.header-inner { min-height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: bold 1.35rem/1 var(--display); text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--gold);
  font: 17px/1 var(--sans);
}
.header-inner nav { display: flex; align-items: center; gap: clamp(1rem, 2.65vw, 2.25rem); }
.header-inner nav a { display: inline-flex; align-items: center; min-height: 40px; font-size: .88rem; font-weight: 600; text-decoration: none; }
.header-inner [aria-current] { color: var(--accent); }
.header-inner [aria-current]:not(.search-link) { text-decoration: underline; text-underline-offset: .48em; }
.search-link {
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  min-height: 36px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.search-icon {
  width: 12px;
  height: 12px;
  margin-right: 2px;
  position: relative;
  display: inline-block;
  flex: none;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}
.search-icon::after {
  content: "";
  position: absolute;
  right: -4px;
  bottom: -2px;
  width: 5px;
  height: 1.5px;
  transform: rotate(45deg);
  border-radius: 1px;
  background: currentColor;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, .87fr) minmax(0, 1fr);
  min-height: 456px;
  margin-top: 36px;
  border: 1px solid #172636;
  border-radius: 18px;
  overflow: hidden;
  background: radial-gradient(ellipse at 0% 100%, #22384a, #152534 68%);
  color: #fff9ec;
}
.hero-art {
  background: url("study.webp") center 46% / cover no-repeat;
}
.hero-content { align-self: center; padding: 56px clamp(26px, 4.2vw, 60px); }
.hero h1 { font: 400 clamp(3rem, 5.8vw, 5.25rem)/1.02 var(--display); letter-spacing: -.062em; }
.hero h1 span { color: var(--gold); }
.hero p {
  max-width: 300px;
  margin-top: 22px;
  color: #f0e8db;
  font-size: clamp(1.03rem, 1.6vw, 1.24rem);
  line-height: 1.5;
  text-wrap: pretty;
}
.hero-button {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  margin-top: 32px;
  padding: 11px 16px;
  border-radius: 6px;
  background: var(--gold);
  color: #1f2a33;
  font-size: .84rem;
  font-weight: 750;
  text-decoration: none;
}
.hero-button:hover { background: #ffd198; color: #1f2a33; }
.hero-button:focus-visible { outline-color: #fff9ec; }

.home-columns {
  display: grid;
  margin: 48px 0 72px;
  align-items: start;
}
.home-columns.has-topics { grid-template-columns: minmax(0, 1fr) minmax(212px, 282px); gap: clamp(36px, 6.35vw, 92px); }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 19px; }
.section-heading h2 { font: 400 clamp(1.8rem, 3.1vw, 2.6rem)/1.2 var(--display); letter-spacing: -.025em; }
.section-heading > a, .back-link, .footer-inner a { color: var(--accent); font-size: .86rem; font-weight: 650; text-decoration: none; }
.section-heading > a:hover, .back-link:hover, .footer-inner a:hover { text-decoration: underline; }
.section-heading > a { flex: none; }
.post-item {
  position: relative;
  padding: 22px 50px 24px 0;
  border-top: 1px solid var(--line);
}
.post-list > :last-child { border-bottom: 1px solid var(--line); }
.post-meta { display: flex; flex-wrap: wrap; gap: 0 .55rem; color: var(--muted); font-size: .79rem; font-weight: 550; }
.post-item h3 { margin-top: .35rem; font: 400 clamp(1.45rem, 2.5vw, 2rem)/1.22 var(--display); letter-spacing: -.025em; }
.post-item h3:lang(zh) { letter-spacing: -.015em; }
.post-item h3 a { text-decoration: none; }
.post-item h3 a:hover { text-decoration: underline; }
.post-item p { margin-top: 7px; color: var(--muted); font-size: .94rem; text-wrap: pretty; }
.post-arrow {
  position: absolute;
  top: 50%;
  right: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  transform: translateY(-50%);
  border: 1px solid var(--line);
  border-radius: 50%;
  font: 400 1rem/1 var(--sans);
}
.post-item a:hover .post-arrow { border-color: var(--accent); }

.topics { margin-top: 2px; padding: 23px 24px 19px; border: 1px solid var(--line); border-radius: 10px; background: #f5f0e7; }
.topics h2 { margin-bottom: 15px; font: 400 1.55rem/1.15 var(--display); }
.topic-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; list-style: none; }
.topic-list a { display: block; padding: 4px 10px; border: 1px solid #d7cbb9; border-radius: 999px; font-size: .78rem; text-decoration: none; }
.topic-list a:hover { border-color: var(--accent); background: #fffaf1; }
.section-heading a span { margin-left: .15rem; }

.site-footer { border-top: 1px solid var(--line); }
.footer-inner { min-height: 80px; color: var(--muted); font-size: .87rem; }
.footer-inner > span { font: bold 1.07rem var(--display); }
.footer-inner a { display: inline-flex; align-items: center; gap: .35rem; min-height: 40px; }

.page-intro { margin-bottom: 34px; }
.page-intro h1 { font: 400 clamp(2.35rem, 5.2vw, 4.2rem)/1.15 var(--display); letter-spacing: -.045em; overflow-wrap: anywhere; }
.page-intro p { margin-top: .85rem; color: var(--muted); font-size: clamp(1.1rem, 2.15vw, 1.35rem); }
.back-link { display: inline-block; margin-bottom: 1.8rem; }
.archive-year + .archive-year { margin-top: 2.4rem; }
.archive-year h2 { margin-bottom: 11px; color: var(--accent); font: 400 1.55rem/1.2 var(--display); }
.article-intro .post-meta { margin-bottom: .8rem; }
.article-topics { margin-top: 2.2rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }

.toc { margin-bottom: 2rem; padding: 1rem 1.3rem; border-left: 2px solid var(--accent); background: #f5f0e7; }
.toc h2 { font-size: .88rem; }
.toc ul { margin: .45rem 0 0; padding-left: 1.25rem; }
.toc a { color: var(--accent); font-size: .89rem; }
.toc .katex { font-size: 1em; }
.toc-level-3 { margin-left: 1rem; }
.prose { font: var(--reading-font-size)/1.76 var(--display); overflow-wrap: anywhere; }
.prose :is(h1,h2,h3,h4,h5,h6) { margin: 1.65em 0 .45em; line-height: 1.2; }
.prose:lang(zh) { line-height: 1.9; }
.prose h2 { font-size: 1.9rem; letter-spacing: -.025em; }
.prose h3 { font-size: 1.45rem; }
.prose p + p { margin-top: 1em; }
.prose a { color: var(--accent); }
.prose img { max-width: 100%; height: auto; }
.prose .katex { font-size: var(--reading-font-size); letter-spacing: normal; }
.prose .katex-display { max-width: 100%; overflow-x: auto; overflow-y: hidden; padding-block: .25em; }
.prose .katex-display > .katex { width: max-content; min-width: 100%; }
.prose pre { overflow-x: auto; padding: 1rem 1.2rem; background: #192a38; color: #fff9ec; border-radius: 6px; }
.prose code { font-family: ui-monospace, monospace; font-size: .8em; }
.prose :not(pre) > code { padding: .1em .25em; border-radius: 3px; background: #ede7db; }
.prose blockquote { margin-left: 0; padding-left: 1.2rem; border-left: 2px solid var(--accent); color: var(--muted); }
.prose table { display: block; margin-block: 1rem; max-width: 100%; overflow: auto; border-collapse: collapse; }
.prose :is(th, td) { padding: .25rem .7rem; border: 1px solid var(--line); }
.about-copy { padding: 20px 0 0; border-top: 1px solid var(--line); }
.empty-state { display: flex; align-items: center; gap: 16px; min-height: 88px; padding: 18px 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft-paper); color: var(--muted); font-size: .93rem; }
.paper-icon { display: grid; place-items: center; flex: none; width: 35px; height: 35px; border-radius: 50%; color: var(--accent); background: #ebe0ce; }
.paper-icon::before { display: block; width: 13px; height: 16px; border: 1px solid currentColor; border-radius: 2px; background: linear-gradient(currentColor, currentColor) center 5px / 6px 1px no-repeat, linear-gradient(currentColor, currentColor) center 8px / 6px 1px no-repeat; content: ""; }

.search-field {
  display: flex;
  gap: 14px;
  align-items: center;
  border: 1px solid #a99d8c;
  border-radius: 8px;
  background: #fffdf9;
  padding: 0 1rem;
}
.search-field:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.search-field input { min-width: 0; width: 100%; padding: 13px 0; outline: 0; border: 0; background: none; color: var(--ink); font: inherit; }
.search-field input:focus-visible { outline: 0; }
.search-status { margin-block: .85rem 1.2rem; color: var(--muted); font-size: .88rem; }

@media (max-width: 960px) {
  .site-frame { width: calc(100% - 64px); }
  .hero { min-height: 372px; }
}
@media (max-width: 760px) {
  .site-frame, .reading-frame { width: calc(100% - 32px); }
  .reading-frame { margin-block: 44px 62px; }
  .header-inner { min-height: 60px; gap: .65rem; }
  .brand { gap: 6px; font-size: 1.16rem; }
  .brand-mark { width: 23px; height: 23px; font-size: 14px; }
  .header-inner nav { gap: .7rem; }
  .header-inner nav a { font-size: .79rem; }
  .header-inner nav .search-link { width: 38px; min-height: 38px; padding: 0; }
  .search-label { display: none; }
  .hero { grid-template-columns: 1fr; min-height: auto; margin-top: 18px; border-radius: 13px; }
  .hero-art { height: clamp(220px, 64vw, 370px); background-position: center 48%; }
  .hero-content { padding: 28px 21px; }
  .hero h1 { font-size: clamp(2.95rem, 11.4vw, 4.5rem); }
  .hero p { max-width: 250px; margin-top: 13px; }
  .hero-button { margin-top: 18px; }
  .home-columns { margin: 32px 0 52px; }
  .home-columns.has-topics { grid-template-columns: 1fr; gap: 28px; }
  .section-heading { gap: .65rem; margin-bottom: 13px; }
  .section-heading > a { font-size: .79rem; }
  .post-item { padding-block: 17px 19px; }
  .topics { padding: 19px 20px 16px; }
  .empty-state { min-height: 72px; padding: 13px 15px; gap: 12px; }
}
@media (max-width: 355px) {
  .header-inner nav { gap: .5rem; }
  .header-inner nav a { font-size: .72rem; }
  .brand { font-size: 1.02rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

.search-result-title { font: 400 1.65rem/1.22 var(--display); letter-spacing: -.025em; }
.search-result-title a { text-decoration: none; }
.search-result-title a:hover { text-decoration: underline; }
