:root {
  --ink: #1d2825;
  --muted: #66736e;
  --paper: #f4f1e9;
  --card: #fffdf8;
  --line: #d8d6cc;
  --green: #1c5d4d;
  --green-dark: #10483b;
  --rust: #be5838;
  --mark: #ffe4a8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.masthead { max-width: 1200px; margin: 0 auto; padding: 28px 32px 18px; display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.site-title {
  margin: 0;
  color: var(--green-dark);
  font: 800 clamp(1.375rem, 3vw, 2rem)/1.3 "Songti SC", "STSong", "SimSun", serif;
  text-wrap: balance;
}
.site-title a { display: grid; align-items: center; min-height: 44px; color: inherit; text-decoration: none; }
.site-title a:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

main { max-width: 1200px; margin: 0 auto; padding: 0 32px 72px; }
.overview { padding: 16px 0; border-block: 1px solid var(--line); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.stats div { padding-left: 20px; border-left: 1px solid var(--line); }
.stats dt { color: var(--muted); font-size: 12px; }
.stats dd { margin: 8px 0 0; font: 700 20px/1.1 Georgia, serif; }

.search-panel { margin: 26px 0 22px; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,253,248,.82); box-shadow: 0 10px 30px rgba(50,52,43,.05); backdrop-filter: blur(10px); }
#filters { display: grid; grid-template-columns: minmax(250px, 1fr) auto 150px 130px auto auto; align-items: end; gap: 12px; }
#filterToggle { display: none; }
#advancedFilters { display: contents; }
#filters label span { display: block; margin: 0 0 7px 2px; color: var(--muted); font-size: 12px; }
input, select { width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 11px; padding: 0 12px; color: var(--ink); background: #fffefa; outline: none; }
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(28,93,77,.1); }
.date-fields { display: grid; grid-template-columns: 145px 145px; gap: 8px; }
.primary, .ghost, .pagination button, .read-button { height: 44px; border-radius: 11px; border: 1px solid transparent; padding: 0 17px; cursor: pointer; }
.primary { color: white; background: var(--green); font-weight: 650; }
.primary:hover { background: var(--green-dark); }
.ghost { border-color: var(--line); color: var(--ink); background: transparent; }
.result-bar { display: flex; justify-content: space-between; gap: 16px; margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.result-bar p { margin: 0; }
.result-bar a, .source-link { color: var(--green); text-decoration: none; font-weight: 650; }

.post-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; transition: opacity .15s; }
.post-list.loading { opacity: .45; }
.post-card { overflow-wrap: anywhere; display: flex; min-height: 280px; flex-direction: column; padding: 25px 26px 21px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: 0 8px 25px rgba(50,52,43,.045); }
.post-card header { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.post-type { padding: 5px 8px; border-radius: 7px; color: var(--green); background: #e8f0eb; font-weight: 650; }
.post-card h3 { margin: 20px 0 0; font: 700 21px/1.45 Georgia, "Songti SC", serif; }
.post-text { margin: 18px 0; line-height: 1.9; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 9; -webkit-box-orient: vertical; overflow: hidden; }
.post-card blockquote, #postDialog blockquote { margin: 0 0 18px; padding: 13px 15px; border-left: 3px solid #9faaa4; color: #59625e; background: #f1f2ed; line-height: 1.7; white-space: pre-wrap; }
.post-card footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: auto; padding-top: 16px; border-top: 1px solid #e8e5dc; }
.metrics { color: var(--muted); font-size: 12px; }
.read-button { min-height: 44px; padding: 0 12px; border-color: var(--line); color: var(--green); background: transparent; font-size: 13px; }
mark { padding: 0 .08em; color: inherit; background: var(--mark); border-radius: 2px; }
.empty-state { grid-column: 1 / -1; padding: 90px 30px; border: 1px dashed #bdbdb5; border-radius: 18px; color: var(--muted); text-align: center; }
.empty-state.error { color: var(--rust); }
.pagination { display: flex; justify-content: center; align-items: center; gap: 18px; margin-top: 28px; }
.pagination button { border-color: var(--line); background: var(--card); }
.pagination button:disabled { opacity: .4; cursor: default; }
.pagination span { min-width: 100px; color: var(--muted); text-align: center; font-size: 13px; }

.masthead nav { display: flex; flex: none; gap: 4px; }
.masthead nav a { display: grid; place-items: center; min-width: 44px; min-height: 44px; color: var(--muted); text-decoration: none; }
.masthead nav a[aria-current="page"] { color: var(--green); font-weight: 650; text-decoration: underline; text-underline-offset: .4em; }
.masthead nav a:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.about-page { max-width: 42rem; margin: 0 auto; padding: 24px 20px 64px; line-height: 1.8; }
.about .masthead { position: relative; }
.about .masthead::after { content: ""; position: absolute; bottom: 0; inset-inline: 32px; border-bottom: 1px solid var(--line); }
@media (max-width: 720px) { .about .masthead::after { inset-inline: 16px; } }
.skip-link { position: absolute; z-index: 2; top: 4px; left: 16px; transform: translateY(calc(-100% - 4px)); padding: 8px 12px; color: var(--green-dark); background: var(--card); }
.skip-link:focus { transform: none; }
.about-page h1 { margin: 0 0 8px; font-size: 1.75rem; }
.about-page h2 { margin: 0 0 6px; font-size: 1.15rem; }
.about-page p { margin: 0; }
.about-page section { margin-top: 24px; }
.about-page footer { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }
.about-page summary { width: fit-content; min-height: 44px; padding: 9px 0; color: var(--green); cursor: pointer; }
.about-page footer img { display: block; width: min(256px, 100%); height: auto; margin-top: 12px; }
.about-page a { color: var(--green); text-underline-offset: .2em; }
@media (hover: hover) {
  .about a:hover { color: var(--green-dark); text-decoration: underline; text-decoration-thickness: 2px; }
}
.about-page a:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

#postDialog { width: min(820px, calc(100vw - 28px)); max-height: 88vh; padding: 0; border: 0; border-radius: 22px; color: var(--ink); background: var(--card); box-shadow: 0 34px 100px rgba(16,35,30,.35); }
#postDialog::backdrop { background: rgba(13,30,26,.58); backdrop-filter: blur(4px); }
#dialogContent { overflow-wrap: anywhere; padding: 45px 52px 52px; }
.dialog-close { position: sticky; float: right; top: 15px; right: 15px; z-index: 2; width: 44px; height: 44px; margin: 14px 14px 0 0; border: 0; border-radius: 50%; color: var(--muted); background: #ebeae4; font-size: 25px; cursor: pointer; }
.dialog-meta { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
#dialogContent h2 { margin: 0 0 25px; font: 700 30px/1.35 Georgia, "Songti SC", serif; }
.dialog-body { max-width: 42em; margin-bottom: 24px; font-size: 17px; line-height: 1.85; white-space: pre-wrap; }
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 26px 0; }
.gallery img { width: auto; max-width: 100%; height: auto; align-self: start; border-radius: 10px; background: #eee; }

@media (max-width: 1100px) {
  #filters { grid-template-columns: 1fr 1fr 1fr; }
  .search-field, .date-fields { grid-column: span 2; }
}
@media (max-width: 720px) {
  .masthead, main { padding-left: 16px; padding-right: 16px; }
  .masthead { align-items: flex-start; }
  .overview { padding: 12px 0; }
  .stats { gap: 8px; }
  .stats div { padding-left: 10px; }
  .stats dd { font: 600 clamp(13px, 3.7vw, 16px)/1.35 system-ui, sans-serif; overflow-wrap: anywhere; }
  #filters { grid-template-columns: minmax(0, 1fr) auto; }
  .search-field { grid-column: 1; }
  #filterToggle { display: block; }
  #advancedFilters { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  #filterToggle[aria-expanded="false"] + #advancedFilters, #filters .primary { display: none; }
  #resetFilters { grid-column: 1 / -1; }
  #filters:not(.has-filters) #resetFilters { display: none; }
  .date-fields { grid-column: 1 / -1; }
  .date-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #filters label, input, select { min-width: 0; }
  .post-list { grid-template-columns: 1fr; }
  .post-card { min-height: 0; }
  #dialogContent { padding: 34px 24px 38px; }
  .pagination { gap: 8px; }
  .pagination span { min-width: 0; }
  .gallery { grid-template-columns: 1fr; }
}
