/* 夜航手记 — shared design layer; base content styles live in style.css. */
:root {
  color-scheme: dark;
  --bg: #14191e;
  --bg-elevated: #1b2228;
  --bg-card: #192026;
  --border: #343d43;
  --text: #e4e2d9;
  --text-muted: #a3aaa9;
  --accent: #b6c6b3;
  --accent-dim: #b6c6b312;
  --link: #b6c6b3;
  --footer-bg: #14191e;
  --danger: #f2a7a0;
  --radius: 4px;
  --radius-sm: 3px;
  --shadow: none;
  --max-width: 720px;
  --font-serif: Georgia, "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", "STSong", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans CJK SC", sans-serif;
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f0e9;
  --bg-elevated: #eae7df;
  --bg-card: #eeeae2;
  --border: #d0ccc1;
  --text: #333a33;
  --text-muted: #656d64;
  --accent: #4c6752;
  --accent-dim: #4c675210;
  --link: #4c6752;
  --footer-bg: #f3f0e9;
  --danger: #a83830;
  --shadow: none;
}
[hidden] { display: none !important; }
body, html[data-theme="light"] body { background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; display: flex; flex-direction: column; }
::selection { background: var(--accent); color: var(--bg); }
a { text-underline-offset: 5px; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
main { width: 100%; max-width: 1024px; padding: 3.5rem 3rem 4rem; flex: 1; }
.site-header, html[data-theme="light"] .site-header {
  position: static; height: auto; background: var(--bg); border: 0; backdrop-filter: none;
}
.site-header__inner {
  max-width: 928px; min-height: 92px; padding: 1rem 0; border-bottom: 1px solid var(--border); gap: 1.6rem; flex-wrap: nowrap;
}
.logo { font-size: 1.1rem; letter-spacing: .045em; font-weight: 600; white-space: nowrap; }
.logo span { color: var(--accent); }
.site-tagline { font-size: .7rem; color: var(--text-muted); letter-spacing: .12em; }
.nav { gap: 1.7rem; flex-wrap: nowrap; }
.nav a { border-radius: 0; padding: .45rem 0; font-size: .82rem; font-weight: 400; white-space: nowrap; }
.nav a:hover, .nav a.is-active { background: transparent; color: var(--accent); }
.nav a.is-active { box-shadow: 0 1px var(--accent); }
.theme-toggle { width: 2.25rem; height: 2.25rem; border: 0; background: transparent; color: var(--text-muted); }
.theme-toggle:hover { background: var(--accent-dim); color: var(--text); }
.skip-link { position: absolute; left: 1rem; top: .5rem; padding: .5rem 1rem; background: var(--bg-elevated); z-index: 101; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

/* Homepage: a quiet introduction, one selected essay, and four paths. */
body[data-page="home"] main { padding-top: 0; }
.night-hero { padding: 4.8rem 0 4.3rem; position: relative; }
.night-overline { color: var(--accent); text-transform: uppercase; font-size: .68rem; letter-spacing: .22em; margin: 0 0 1.6rem; }
.night-hero h1 { font-family: var(--font-serif); font-size: clamp(1.8rem, 4.5vw, 3rem); line-height: 1.65; letter-spacing: .035em; font-weight: 400; margin: 0 0 1.5rem; }
.night-hero__intro { font-size: .93rem; line-height: 2; color: var(--text-muted); margin: 0; }
.night-hero__motto { font-size: .66rem; letter-spacing: .1em; color: var(--text-muted); margin: 2rem 0 0; text-transform: uppercase; }
.night-hero__motto span { margin: 0 .6rem; }
.night-star { position: absolute; right: 2.2rem; top: 5.9rem; font-size: 4rem; line-height: 1; color: var(--accent); opacity: .7; }
.night-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; }
.night-section__head h2 { font: 400 .85rem var(--font-sans); color: var(--text-muted); margin: 0; letter-spacing: .06em; }
.night-section__head a { color: var(--text-muted); font-size: .75rem; }
.night-feature { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 1.75rem; padding: 2.25rem 0; border-block: 1px solid var(--border); color: var(--text); }
.night-feature:hover, .night-post:hover { text-decoration: none; }
.night-feature__mark { align-self: center; justify-self: center; font-size: 3rem; color: var(--accent); opacity: .6; }
.night-post__meta { font-size: .72rem; color: var(--text-muted); }
.night-post__title { font-family: var(--font-serif); font-weight: 400; font-size: 1.3rem; line-height: 1.5; margin: .5rem 0; color: var(--text); overflow-wrap: anywhere; }
.night-feature .night-post__title { font-size: 1.9rem; }
.night-post__excerpt { color: var(--text-muted); font-size: .85rem; line-height: 1.9; margin: .5rem 0 0; }
.night-feature__read { display: inline-block; margin-top: 1.25rem; color: var(--accent); font-size: .75rem; }
.night-feature:hover .night-post__title, .night-post:hover .night-post__title { color: var(--accent); }
.night-routes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2rem; padding: 2.4rem 0; }
.night-routes > a { position: relative; padding: .4rem 0 1rem; color: var(--text); border-bottom: 1px solid var(--border); }
.night-routes > a:hover { text-decoration: none; border-color: var(--accent); }
.night-routes__index { font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.night-routes h2 { font: 400 1.45rem var(--font-serif); letter-spacing: .12em; margin: 1rem 0 .5rem; }
.night-routes p { font-size: .74rem; color: var(--text-muted); margin: 0; }
.night-routes__arrow { position: absolute; top: 2.8rem; right: 0; font-size: .9rem; color: var(--text-muted); }
.night-recent { margin-top: 2.5rem; }
.night-post-list { list-style: none; margin: 0; padding: 0; }
.night-post { display: flex; gap: 2rem; align-items: center; justify-content: space-between; padding: 1.6rem 0; border-top: 1px solid var(--border); }
.night-post__content { min-width: 0; }
.night-post__arrow { color: var(--text-muted); flex: 0 0 auto; }
.night-loading { color: var(--text-muted); padding: 1.6rem 0; }
.night-invitation { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 2.5rem 0 0; margin-top: 2rem; border-top: 1px solid var(--border); }
.night-invitation p { font-family: var(--font-serif); font-size: 1.15rem; margin: 0; }
.night-invitation a { font-size: .8rem; white-space: nowrap; }

/* Collections retain their existing data and links, with typography-led rows. */
.page-title, .article-header h1 { font-family: var(--font-serif); font-weight: 400; letter-spacing: .035em; line-height: 1.55; font-size: clamp(1.8rem, 4vw, 2.5rem); overflow-wrap: anywhere; }
.page-desc { font-size: .9rem; color: var(--text-muted); line-height: 1.9; }
.breadcrumb { font-size: .75rem; line-height: 1.8; color: var(--text-muted); overflow-wrap: anywhere; }
.breadcrumb a { color: var(--text-muted); }
.collection-nav { display: flex; flex-wrap: wrap; gap: 1.5rem; margin: 2rem 0; font-size: .82rem; }
.collection-nav a { color: var(--text-muted); padding: .3rem 0; }
.collection-nav a[aria-current] { color: var(--accent); border-bottom: 1px solid var(--accent); }
.v2-post-grid { display: grid; grid-template-columns: minmax(0, 1fr); list-style: none; padding: 0; margin: 2rem 0; gap: 0; }
.v2-card { display: flex; flex-direction: column; gap: .7rem; padding: 1.8rem 0; border-top: 1px solid var(--border); color: var(--text); }
.v2-card:hover { text-decoration: none; }
.v2-card__top { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; font-size: .72rem; color: var(--text-muted); }
.v2-chip--cat { color: var(--accent); }
.v2-chip--pin { font-size: .65rem; border: 1px solid var(--border); padding: 0 .35rem; }
.v2-card__date { margin-left: auto; }
.v2-card__title { font: 400 1.4rem/1.5 var(--font-serif); margin: 0; overflow-wrap: anywhere; }
.v2-card:hover .v2-card__title { color: var(--accent); }
.v2-card__excerpt { font-size: .87rem; color: var(--text-muted); margin: 0; line-height: 1.9; }
.v2-card__foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.v2-tags { display: flex; gap: .75rem; flex-wrap: wrap; }
.v2-tag { color: var(--text-muted); font-size: .7rem; }
.v2-tag::before { content: "# "; opacity: .7; }
.v2-card__arrow { color: var(--accent); }
.tag-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 1rem; }
.tag-card, html[data-theme="light"] .tag-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: none; }
.tag-card:hover, html[data-theme="light"] .tag-card:hover { transform: none; box-shadow: none; border-color: var(--accent); }
.tag-card__name, html[data-theme="light"] .tag-card__name { color: var(--text); font-family: var(--font-serif); font-weight: 400; }
.tag-card__count, .tag-card__arrow, html[data-theme="light"] .tag-card__count, html[data-theme="light"] .tag-card__arrow { color: var(--text-muted); }
.archive-year__title { font-family: var(--font-serif); font-weight: 400; font-size: 1.7rem; color: var(--accent); }
.archive-item { padding: .9rem 0; }
.archive-item__link { color: var(--text); overflow-wrap: anywhere; }
.archive-item__date { color: var(--text-muted); }
.featured-item { border: 1px solid var(--border); background: var(--bg-card); border-radius: var(--radius); box-shadow: none; }
.featured-author { color: var(--accent); }
.featured-text { color: var(--text); }

/* Long-form reading. */
.reading-page main { max-width: 816px; }
.article-header { padding-bottom: 2rem; margin-top: 2rem; }
.article-body { font-size: 1.02rem; line-height: 2; color: var(--text); overflow-wrap: anywhere; }
.article-body p { margin-bottom: 1.4rem; }
.article-body h1, .article-body h2, .article-body h3, .article-body h4 { font-family: var(--font-serif); font-weight: 500; line-height: 1.65; margin-top: 2.3rem; }
.article-body h2 { border-bottom: 0; }
.article-body blockquote, html[data-theme="light"] .article-body blockquote { background: transparent; border-left: 2px solid var(--accent); border-radius: 0; padding: .2rem 0 .2rem 1.5rem; font-style: normal; }
.article-body pre, html[data-theme="light"] .article-body pre { background: var(--bg-elevated); border-color: var(--border); }
.article-body strong, html[data-theme="light"] .article-body strong { color: var(--text); font-weight: 650; }
.article-body img, html[data-theme="light"] .article-body img { box-shadow: none; }
.article-body table, html[data-theme="light"] .article-body table { display: block; max-width: 100%; overflow-x: auto; border-color: var(--border); }
.article-body tr:hover td, html[data-theme="light"] .article-body tr:hover td { background: var(--accent-dim); }
.article-stats { flex-wrap: wrap; }
.article-reactions-hint { opacity: 1; color: var(--text-muted); }
.article-views:has(#busuanzi_value_page_pv:empty),
#busuanzi_container_site_uv:has(#busuanzi_value_site_uv:empty) { display: none !important; }
.back-link { font-size: .8rem; }
.about-signature { color: var(--accent); font-family: var(--font-serif); font-style: italic; }

/* Compact footer keeps the same external links. */
.site-footer--rich, html[data-theme="light"] .site-footer--rich { width: calc(100% - 6rem); max-width: 928px; padding: 2rem 0 2.5rem; background: transparent; color: var(--text-muted); }
.footer-signature { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .75rem; font-size: .75rem; margin-bottom: 1.5rem; }
.footer-grid { display: block; margin: 0 0 1.5rem; }
.footer-col { display: flex; align-items: baseline; gap: 1.5rem; }
.footer-col ul { display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; }
.footer-col__title, html[data-theme="light"] .footer-col__title { font-size: .7rem; color: var(--text-muted); font-weight: 400; white-space: nowrap; }
.footer-col a, html[data-theme="light"] .footer-col a { color: var(--text-muted); font-size: .75rem; }
.footer-col a:hover, html[data-theme="light"] .footer-col a:hover { color: var(--accent); }
.footer-note, html[data-theme="light"] .footer-note { color: var(--text-muted); font-size: .66rem; border: 0; padding: 0; margin: 0; }

@media (max-width: 1024px) { .site-header__inner { margin: 0 3rem; } }
@media (max-width: 760px) {
  .site-tagline { display: none; }
  .site-header__inner { gap: 1rem; }
  .nav { gap: 1.2rem; }
  .night-star { font-size: 2.5rem; right: .25rem; top: 4rem; }
  .night-hero { padding-top: 3rem; }
  .night-routes { gap: 1rem; }
}
@media (max-width: 600px) {
  main { padding: 2rem 1.5rem 3rem; }
  .site-header__inner { margin: 0 1.5rem; min-height: 80px; padding: 1rem 0; gap: .75rem; flex-direction: row; align-items: center; flex-wrap: wrap; justify-content: space-between; }
  .logo { font-size: 1rem; }
  .theme-toggle { margin-left: auto; }
  .nav { order: 3; width: 100%; margin-left: 0; justify-content: flex-start; gap: 1.75rem; }
  .nav a { padding: .3rem 0; }
  .night-hero { padding: 3rem 0; }
  .night-hero h1 { font-size: clamp(1.45rem, 5.4vw, 2rem); letter-spacing: .02em; }
  .night-star { display: none; }
  .night-hero__motto { max-width: 22rem; line-height: 2; }
  .night-feature { grid-template-columns: minmax(0, 1fr); padding: 1.75rem 0; }
  .night-feature__mark { display: none; }
  .night-feature .night-post__title { font-size: 1.7rem; }
  .night-routes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; padding: 1.8rem 0; }
  .night-routes p { font-size: .72rem; }
  .night-recent { margin-top: 1.5rem; }
  .night-section__head { flex-wrap: wrap; }
  .night-invitation p { font-size: 1rem; }
  .site-footer--rich { width: calc(100% - 3rem); }
  .footer-col { display: block; }
  .article-body { font-size: 1rem; }
  .article-body pre { padding: 1rem; }
  .v2-card__title { font-size: 1.3rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media (pointer: coarse) {
  .nav a, .theme-toggle, .collection-nav a { min-height: 44px; display: inline-flex; align-items: center; }
  .theme-toggle { min-width: 44px; justify-content: center; }
}
