:root {
  --bg: #f7f8f3;
  --paper: #ffffff;
  --ink: #242b28;
  --body: #5e6c63;
  --muted: #6c7d71;
  --green: #285b46;
  --soft: #edf2e9;
  --line: #dbe2d7;
  --copper: #8c6039;
  --serif: "Noto Serif SC", "Songti SC", STSong, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #101615;
  --paper: #17211e;
  --ink: #e5eee8;
  --body: #b6c5ba;
  --muted: #92a99e;
  --green: #9ccbb7;
  --soft: #1e3028;
  --line: #2e4138;
  --copper: #d1ad82;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.7 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
h1, h2, h3, p { margin: 0; }
svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
a, button, input { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--green); outline-offset: 5px; }
::selection { background: #456957; color: #fff; }
.page-width { width: min(1000px, calc(100% - 96px)); margin-inline: auto; }
.skip-link { position: fixed; top: -80px; left: 18px; z-index: 20; padding: 10px 15px; background: var(--green); color: var(--bg); }
.skip-link:focus { top: 12px; }
#main:focus { outline: none; }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner { width: min(1120px, calc(100% - 80px)); height: 88px; margin: auto; display: flex; align-items: center; gap: 44px; }
.brand { display: inline-flex; gap: 12px; align-items: center; font-size: 20px; font-weight: 600; letter-spacing: 1px; white-space: nowrap; }
.brand-symbol { width: 36px; height: 38px; display: grid; place-items: center; color: var(--green); }
.brand-symbol svg { width: 31px; height: 31px; }
.presence-dot { fill: currentColor; stroke: none; }
.main-nav { display: flex; align-items: center; gap: 31px; margin-left: auto; }
.main-nav a { color: var(--body); font-size: 14px; padding: 9px 0; position: relative; }
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--green); }
.main-nav a[aria-current="page"]:after { content: ""; position: absolute; height: 2px; bottom: 0; left: 0; right: 0; background: var(--green); border-radius: 2px; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 6px; color: var(--body); }
.icon-button:hover { background: var(--soft); color: var(--green); }
.icon-button svg { width: 19px; height: 19px; }
.intro { padding-top: 66px; padding-bottom: 60px; }
.intro h1 { font: 500 clamp(35px, 4vw, 48px)/1.55 var(--serif); letter-spacing: .5px; }
.intro h1 span { color: var(--green); }
.intro p { color: var(--body); line-height: 1.95; margin-top: 22px; }
.page-heading { padding-top: 52px; padding-bottom: 27px; }
.page-heading h1 { font: 500 34px/1.6 var(--serif); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.section-heading h2 { font: 500 27px/1.6 var(--serif); }
.section-heading a { color: var(--body); font-size: 14px; }
.section-heading a:hover { color: var(--green); }
.section-heading a span { margin-left: 8px; }
.articles-section { border-top: 1px solid var(--line); padding-top: 33px; }
.article-tabs { display: flex; gap: 31px; border-bottom: 1px solid var(--line); }
.article-tabs button { position: relative; padding: 0 2px 13px; font-size: 17px; color: var(--body); }
.article-tabs button.active { color: var(--green); }
.article-tabs button.active:after { content: ""; position: absolute; height: 2px; bottom: -1px; left: 0; right: 0; background: var(--green); }
.study-filters { display: flex; flex-wrap: wrap; gap: 7px; padding: 18px 0 8px; }
.study-filters button { color: var(--body); font-size: 13px; padding: 5px 11px; border-radius: 4px; }
.study-filters button.active { color: var(--green); background: var(--soft); }
.study-filters button:hover { color: var(--green); }
.article-list { list-style: none; margin: 0; padding: 0; }
.article-row { border-bottom: 1px solid var(--line); }
.article-link { display: flex; align-items: center; justify-content: space-between; gap: 32px; padding: 24px 0; }
.article-link h3 { font-size: 19px; font-weight: 500; line-height: 1.7; }
.article-link p { font-size: 14px; color: var(--body); margin-top: 7px; line-height: 1.85; }
.article-link:hover h3 { color: var(--green); }
.article-category { color: var(--muted); font-size: 13px; white-space: nowrap; }
.more-link { display: inline-flex; align-items: center; gap: 16px; color: var(--green); margin-top: 24px; font-size: 14px; }
.empty-state { padding: 40px 0; color: var(--muted); }
.projects-section { margin-top: 57px; }
.project-list { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.project-card { display: flex; flex-direction: column; padding: 26px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); transition: border-color .2s, transform .2s; }
.project-card:hover { border-color: var(--green); transform: translateY(-2px); }
.project-card-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.project-card h3 { font-size: 20px; font-weight: 500; }
.project-card-title > span { color: var(--muted); font-size: 19px; }
.project-card p { font-size: 14px; line-height: 1.9; color: var(--body); margin-top: 12px; }
.award { display: inline-flex; align-items: center; gap: 7px; color: var(--copper); margin-top: 23px; font-size: 13px; }
.award:before { content: ""; display: block; height: 7px; width: 7px; border-radius: 50%; background: currentColor; }
.about-section { max-width: 760px; margin-left: max(48px, calc((100% - 1000px) / 2)); }
.about-section p { color: var(--body); font-size: 16px; line-height: 2; margin-bottom: 24px; }
.site-footer { border-top: 1px solid var(--line); padding: 25px 0 30px; margin-top: 65px; color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; gap: 22px; }
.site-footer > div { display: flex; align-items: center; gap: 26px; }
.site-footer a:hover, .site-footer button:hover { color: var(--green); }
body[data-route="articles"] .articles-section { padding-top: 0; border-top: 0; }
body[data-route="projects"] .projects-section { margin-top: 0; }
body[data-route="about"] .site-footer { margin-top: 70px; }
.detail-view { max-width: 760px; padding-top: 42px; }
.back-link { display: inline-block; margin-bottom: 33px; color: var(--body); font-size: 14px; }
.detail-meta { color: var(--green); font-size: 14px; display: flex; align-items: center; flex-wrap: wrap; gap: 11px; }
.detail-meta a:hover { text-decoration: underline; }
.draft-label { color: var(--muted); border-left: 1px solid var(--line); padding-left: 11px; }
.detail-view h1 { font: 500 clamp(27px, 3.2vw, 36px)/1.6 var(--serif); margin: 16px 0 29px; }
.detail-body { color: var(--body); font-size: 16px; line-height: 2.05; border-top: 1px solid var(--line); padding-top: 11px; }
.detail-body h2 { font: 500 24px/1.7 var(--serif); color: var(--ink); margin: 31px 0 14px; }
.detail-body h3 { font-size: 19px; font-weight: 500; color: var(--ink); margin: 24px 0 12px; }
.detail-body p { margin: 22px 0; }
.detail-body code { font-family: ui-monospace, monospace; font-size: .88em; background: var(--soft); padding: 2px 5px; border-radius: 3px; }
.detail-body pre { background: var(--soft); border: 1px solid var(--line); padding: 22px; overflow-x: auto; border-radius: 5px; }
.detail-body pre code { padding: 0; }
.detail-body blockquote { border-left: 2px solid var(--green); padding-left: 20px; margin: 25px 0; }
.next-article { display: block; border-top: 1px solid var(--line); padding-top: 25px; margin-top: 39px; }
.next-article span { display: block; color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.next-article strong { font-size: 17px; font-weight: 500; }
.next-article:hover strong { color: var(--green); }
dialog { background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 9px; padding: 0; width: 620px; max-width: calc(100% - 32px); box-shadow: 0 24px 90px #0005; }
dialog::backdrop { background: #07100c99; backdrop-filter: blur(4px); }
#search-dialog { margin: 16vh auto auto; }
.search-input-row { display: flex; align-items: center; gap: 15px; border-bottom: 1px solid var(--line); padding: 16px 20px; }
.search-input-row > svg { width: 21px; height: 21px; flex-shrink: 0; color: var(--muted); }
.search-input-row input { min-width: 0; flex: 1; background: none; border: 0; outline: 0; font-size: 16px; padding: 5px 0; }
.search-input-row:focus-within { box-shadow: inset 0 -2px var(--green); }
#close-search { font-size: 25px; flex-shrink: 0; }
#search-results { max-height: 55vh; overflow-y: auto; padding: 8px; }
.search-result { display: block; padding: 14px 13px; border-radius: 5px; }
.search-result:hover, .search-result:focus { background: var(--soft); }
.search-result strong { display: block; font-size: 15px; font-weight: 500; }
.search-result span { display: block; color: var(--muted); font-size: 13px; margin-top: 5px; }
.search-empty { padding: 32px 16px; text-align: center; font-size: 14px; color: var(--muted); }
@media (max-width: 800px) {
  .page-width { width: calc(100% - 56px); }
  .header-inner { width: calc(100% - 48px); gap: 25px; }
  .main-nav { gap: 23px; }
  .brand { font-size: 18px; gap: 8px; }
  .header-actions { gap: 5px; }
  .intro { padding: 48px 0; }
  .article-category { display: none; }
  .project-card { padding: 22px; }
  .project-card h3 { font-size: 18px; }
  .about-section { margin-left: 28px; }
}
@media (max-width: 560px) {
  .page-width { width: calc(100% - 40px); }
  .header-inner { width: calc(100% - 32px); min-height: 112px; height: auto; flex-wrap: wrap; gap: 10px 18px; padding: 17px 0 0; }
  .brand { font-size: 18px; }
  .brand-symbol { width: 29px; height: 29px; }
  .brand-symbol svg { width: 27px; height: 27px; }
  .header-actions { margin-left: auto; }
  .main-nav { order: 3; margin: 0; width: 100%; justify-content: space-between; gap: 20px; padding-inline: 4px; }
  .main-nav a { padding: 4px 0 12px; font-size: 14px; }
  .intro { padding-top: 37px; padding-bottom: 36px; }
  .intro h1 { font-size: clamp(29px, 7.8vw, 38px); line-height: 1.65; letter-spacing: 0; }
  .intro p { font-size: 14px; margin-top: 18px; }
  .section-heading { margin-bottom: 20px; }
  .section-heading h2 { font-size: 24px; }
  .section-heading a { font-size: 13px; }
  .articles-section { padding-top: 26px; }
  .article-tabs button { font-size: 16px; }
  .study-filters { gap: 3px; padding-top: 15px; }
  .study-filters button { padding: 6px 8px; font-size: 12px; }
  .article-link { padding: 21px 0; gap: 0; }
  .article-link h3 { font-size: 17px; }
  .article-link p { font-size: 13px; line-height: 1.85; margin-top: 7px; }
  .projects-section { margin-top: 42px; }
  .project-list { grid-template-columns: 1fr; gap: 14px; }
  .project-card { padding: 23px; }
  .project-card h3 { font-size: 19px; }
  .project-card p { font-size: 14px; }
  .award { margin-top: 17px; }
  .page-heading { padding-top: 32px; padding-bottom: 25px; }
  .page-heading h1 { font-size: 29px; }
  .about-section { margin-left: 20px; }
  .about-section p { font-size: 15px; }
  .site-footer { font-size: 12px; gap: 16px; margin-top: 44px; padding-top: 21px; }
  .site-footer > div { gap: 18px; }
  .detail-view { padding-top: 27px; }
  .back-link { margin-bottom: 25px; }
  .detail-meta { font-size: 13px; }
  .detail-view h1 { margin: 15px 0 24px; font-size: 27px; }
  .detail-body { font-size: 15px; }
  .detail-body h2 { font-size: 22px; }
  .search-input-row { padding: 13px; gap: 9px; }
  .search-input-row input { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *:before, *:after { transition: none !important; }
  .project-card:hover { transform: none; }
}
