:root {
  color-scheme: light dark;
  --fg: #111;
  --fg-soft: #555;
  --bg: #fff;
  --rule: #e5e5e5;
  --link: #0353a4;
  --link-visited: #5a3aa8;
  --cat: #888;
  --measure: 38rem;
  --max: 56rem;
}
@media (prefers-color-scheme: dark) {
  :root { --fg:#e6e6e6; --fg-soft:#aaa; --bg:#111; --rule:#2a2a2a; --link:#7fb3ff; --link-visited:#c8a2ff; --cat:#888; }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--fg);
  font: 17px/1.7 "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:visited { color: var(--link-visited); }
a:hover { text-decoration: underline; }

.site-header {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 1rem;
  max-width: var(--max); margin: 0 auto; padding: 1.4rem 1.2rem 0.6rem;
  border-bottom: 1px solid var(--rule);
}
.site-header .brand { font-weight: 600; font-size: 1.05rem; }
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem; font-size: 0.92rem; }
.site-header nav a { color: var(--fg-soft); }
.site-header .brand-logo { display: inline-flex; padding: 0; line-height: 0; }
.site-header .brand-logo img { display: block; height: 32px; width: auto; }
.site-header .brand-logo:hover { text-decoration: none; opacity: 0.85; }

main { max-width: var(--measure); margin: 0 auto; padding: 1.4rem 1.2rem 4rem; }
/* Listing pages (home, year, month, /long/, search) get the wider --max
   container so titles have room to fit ~20 Chinese chars on desktop
   instead of wrapping aggressively. Article reading pages stay narrow. */
main:has(.article-list) { max-width: var(--max); }

h1 { font-size: 1.7rem; line-height: 1.3; margin: 0.2em 0 0.3em; }
h2 { font-size: 1.25rem; margin-top: 2.4rem; }
h3 { font-size: 1.1rem; }

.lead { font-size: 1.1rem; color: var(--fg-soft); }
.byline { color: var(--fg-soft); font-size: 0.92rem; margin-top: 0.2em; font-style: italic; }
.stats { color: var(--fg-soft); font-size: 0.95rem; }

.cat { color: var(--cat); font-size: 0.85rem; margin: 0; }
.meta { color: var(--fg-soft); font-size: 0.92rem; margin: 0 0 1.4rem; }
.meta .likes { color: #b48200; }
.breadcrumb { color: var(--fg-soft); font-size: 0.88rem; margin: 0 0 1.2rem; }
.breadcrumb a { color: var(--fg-soft); }

.banner { margin: 1.2rem 0 1.6rem; }
.banner img { width: 100%; height: auto; display: block; border-radius: 2px; }

.article .body img { max-width: 100%; height: auto; }
.article .body p { margin: 1.05em 0; }
.article .body figure { margin: 1.5em 0; }
.article .body figcaption { color: var(--fg-soft); font-size: 0.9rem; margin-top: 0.4em; }
.article .body blockquote { border-left: 3px solid var(--rule); margin: 1.4em 0; padding: 0.2em 0 0.2em 1em; color: var(--fg-soft); }
.article .body img[data-broken="1"] { display: none; }
.article .body p.subtitle { color: var(--fg-soft); font-size: 1.05rem; font-style: italic; margin: -0.4em 0 1.4em; }

.notice {
  background: rgba(180, 130, 0, 0.08);
  border-left: 3px solid #b48200;
  padding: 0.7em 1em;
  margin: 1.2em 0;
  color: var(--fg-soft);
  font-size: 0.92rem;
}
.screenshot-fallback { margin: 1.2em 0; }
.screenshot-fallback img { width: 100%; height: auto; display: block; border-radius: 2px; }

.origin { color: var(--fg-soft); font-size: 0.86rem; word-break: break-all; }
.origin a { color: var(--fg-soft); }

.article-list { list-style: none; padding: 0; margin: 0; }
.article-list li { padding: 0.55rem 0; border-bottom: 1px solid var(--rule); display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.7em; }
.article-list time { color: var(--fg-soft); font-size: 0.86rem; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.article-list .cat { font-size: 0.8rem; color: var(--cat); flex: 0 0 auto; }
/* Long titles should wrap *inside* their slot — flex: 1 + min-width: 0
   stops the anchor from being pushed to a new flex row. */
.article-list li > a { flex: 1 1 0; min-width: 0; word-break: break-word; }
/* Long author names (e.g. "Kate Conger, Richard Fausset and Serge F.
   Kovaleski") must not crowd the title to a single-character column.
   Cap the slot, allow shrink, ellipsis-truncate. */
.article-list .author {
  color: var(--fg-soft);
  font-size: 0.86rem;
  flex: 0 1 14em;
  min-width: 0;
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Author hyperlinks (article meta + listings) stay muted by default
   to match the surrounding text; hover hints they're clickable. */
.article-list .author a,
.article-list .author a:visited,
.article .meta a,
.article .meta a:visited { color: inherit; text-decoration: none; }
.article-list .author a:hover,
.article .meta a:hover { color: var(--link); text-decoration: underline; }

.years { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.6rem; }
.years li { padding: 0.5em 0.8em; border: 1px solid var(--rule); border-radius: 4px; }
.years .count { color: var(--fg-soft); font-size: 0.85rem; margin-left: 0.4em; }

.series-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.5rem; }
.series-list li { padding: 0.55em 0.85em; border: 1px solid var(--rule); border-radius: 4px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4em; }
.series-list li > a { font-weight: 500; }
.series-list .count { color: var(--fg-soft); font-size: 0.85rem; }
.series-list .ratio { color: var(--fg-soft); font-size: 0.82rem; margin-left: auto; }

/* Home page — fixed 4-up grid, no long-article ratio shown */
.series-list.home-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 800px) { .series-list.home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) { .series-list.home-grid { grid-template-columns: 1fr; } }

/* Pure-CSS expand for the home series grid. The checkbox lives just
   before the <ul> so we use the general-sibling combinator (~) to
   reach into the list. Default state: hide the .series-extra tiles
   and show the "查看所有栏目" tile. Once the box is checked: flip
   both. JS-free. */
.series-expand-toggle ~ ul .series-extra { display: none; }
.series-expand-toggle:checked ~ ul .series-expand-tile { display: none; }
.series-expand-toggle:checked ~ ul .series-extra { display: flex; }
.series-list .series-expand-tile { justify-content: center; cursor: pointer; }
.series-list .series-expand-tile label {
  cursor: pointer;
  color: var(--fg-soft);
  font-weight: 500;
  width: 100%;
  text-align: center;
}
.series-list .series-expand-tile:hover { background: var(--rule); }

h2 small { font-weight: normal; font-size: 0.7em; margin-left: 0.6em; }
h2 small a { color: var(--fg-soft); }

.scope-tabs { display: flex; gap: 0.4rem; margin: 0.6rem 0 1.2rem; flex-wrap: wrap; }
.scope-tab { background: transparent; border: 1px solid var(--rule); border-radius: 4px; padding: 0.4em 0.95em; color: var(--fg-soft); cursor: pointer; font: inherit; font-size: 0.92rem; }
.scope-tab.active { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.scope-tab:not(.active):hover { background: var(--rule); color: var(--fg); }

.meta-input { width: 100%; box-sizing: border-box; padding: 0.6em 0.85em; font: inherit; font-size: 1.05rem; border: 1px solid var(--rule); border-radius: 4px; background: var(--bg); color: var(--fg); }
.meta-input:focus { outline: 2px solid var(--link); outline-offset: -1px; }
.result-summary { color: var(--fg-soft); font-size: 0.92rem; margin: 1em 0 0.5em; }
.result-more { color: var(--fg-soft); font-size: 0.85rem; margin-top: 1em; }
mark { background: rgba(180, 130, 0, 0.25); color: inherit; padding: 0 0.05em; }

.subnav { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.6rem 0 1.4rem; font-size: 0.92rem; }
.subnav a { padding: 0.2em 0.55em; border: 1px solid var(--rule); border-radius: 3px; color: var(--fg-soft); }

.tag.long {
  display: inline-block;
  padding: 0.05em 0.45em;
  border-radius: 3px;
  background: #b48200;
  color: #fff;
  font-size: 0.78rem;
  line-height: 1.5;
  font-weight: 500;
}
@media (prefers-color-scheme: dark) {
  .tag.long { background: #d29c1f; color: #111; }
}

.cta { margin: 1.4em 0 1em; }
.btn {
  display: inline-block;
  padding: 0.5em 0.95em;
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--fg);
  background: transparent;
  font-size: 0.95rem;
}
.btn:hover { background: var(--rule); text-decoration: none; }

.result-meta { color: var(--fg-soft); font-size: 0.85rem; font-variant-numeric: tabular-nums; }

.site-footer { max-width: var(--max); margin: 0 auto; padding: 1.6rem 1.2rem 3rem; border-top: 1px solid var(--rule); color: var(--fg-soft); font-size: 0.86rem; }

hr { border: none; border-top: 1px solid var(--rule); margin: 2rem 0; }
