/* LXGW WenKai (霞鹜文楷) — via jsDelivr, accessible in mainland China */
@import url('https://cdn.jsdelivr.net/npm/lxgw-wenkai-webfont@1.7.0/style.css');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Tokens ──────────────────────────────── */

:root {
  --text:   #1a1a18;
  --muted:  #767472;
  --rule:   #ddddd9;
  --bg:     #ffffff;
  --accent: #c0392b;   /* 朱红 vermilion — Chinese seal red */
  --max:    680px;
}

[data-theme="dark"] {
  --text:   #e2e2de;
  --muted:  #888884;
  --rule:   #282826;
  --bg:     #111110;
  --accent: #e05242;   /* brighter in dark mode */
}

/* ── Base ────────────────────────────────── */

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'LXGW WenKai', 'PingFang SC', 'Microsoft YaHei', serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Header ──────────────────────────────── */

header.site {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 3.5rem;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: box-shadow 0.2s ease;
}

header.site.scrolled {
  box-shadow: 0 1px 16px rgba(0, 0, 0, 0.07);
}

[data-theme="dark"] header.site {
  background: rgba(17, 17, 16, 0.88);
}

[data-theme="dark"] header.site.scrolled {
  box-shadow: 0 1px 16px rgba(0, 0, 0, 0.4);
}

.site-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

a.brand { text-decoration: none; color: var(--text); }

.brand-name {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: block;
}

.brand-sub {
  font-size: 0.72rem;
  font-family: system-ui, 'Helvetica Neue', sans-serif;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: block;
  margin-top: 2px;
}

nav {
  display: flex;
  gap: 1.75rem;
  align-items: center;
}

nav a {
  font-size: 0.85rem;
  font-family: system-ui, 'Helvetica Neue', sans-serif;
  color: var(--muted);
  text-decoration: none;
}

nav a:hover { color: var(--text); }

/* ── Theme toggle ────────────────────────── */

#theme-toggle {
  font-size: 0.85rem;
  font-family: system-ui, 'Helvetica Neue', sans-serif;
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: 1;
}

#theme-toggle:hover { color: var(--text); }

/* ── Homepage hero ───────────────────────── */

.hero { margin-bottom: 4rem; }

.hero h1 {
  font-size: clamp(2rem, 6vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 0.85rem;
}

.hero p {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.7;
}

/* ── Post list ───────────────────────────── */

.post-list {
  border-top: 1px solid var(--rule);
  margin-bottom: 6rem;
}

.post-list-label {
  font-size: 0.72rem;
  font-family: system-ui, 'Helvetica Neue', sans-serif;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin: 1.5rem 0 2rem;
}

.post-item {
  padding: 2rem 0;
  border-bottom: 1px solid var(--rule);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.post-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.post-item--has-thumb {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1.25rem;
  align-items: start;
}

.post-item-body { min-width: 0; }

.post-item-thumb {
  display: block;
  overflow: hidden;
  border-radius: 3px;
  aspect-ratio: 4 / 3;
}

.post-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.post-item-thumb:hover img { transform: scale(1.04); }

.post-item-date {
  font-size: 0.78rem;
  font-family: system-ui, 'Helvetica Neue', sans-serif;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.post-item-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: 0.55rem;
}

.post-item-title a { color: var(--text); text-decoration: none; }
.post-item-title a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.post-item-excerpt {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 0.85rem;
  text-align: justify;
  text-justify: inter-ideograph;
}

.post-item-read {
  font-size: 0.82rem;
  font-family: system-ui, 'Helvetica Neue', sans-serif;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.post-item-read:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── Post hero image ─────────────────────── */

.post-hero {
  margin: 0 0 2rem;
  overflow: hidden;
  border-radius: 4px;
}

.post-hero img {
  width: 100%;
  height: auto;
  max-height: 440px;
  object-fit: cover;
  display: block;
}

/* ── Single post ─────────────────────────── */

.back {
  display: inline-block;
  font-size: 0.82rem;
  font-family: system-ui, 'Helvetica Neue', sans-serif;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 3rem;
}

.back:hover { color: var(--text); }
.back::before { content: '← '; }

.post-head { margin-bottom: 2.5rem; }

.post-head-meta {
  font-size: 0.78rem;
  font-family: system-ui, 'Helvetica Neue', sans-serif;
  color: var(--muted);
  margin-bottom: 1rem;
}

.post-head h1 {
  font-size: clamp(1.65rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.post-head .sub {
  font-size: 1rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.6;
}

/* ── Post body ───────────────────────────── */

.post-body {
  font-size: 1.05rem;
  line-height: 1.9;
  border-top: 1px solid var(--rule);
  padding-top: 2.5rem;
  margin-bottom: 5rem;
}

.post-body > p:first-of-type::first-letter {
  font-size: 3em;
  font-weight: 700;
  float: left;
  line-height: 0.85;
  margin: 0.05em 0.1em 0 0;
  color: var(--accent);
}

.post-body p { 
  margin-bottom: 1.45em; 
  text-align: justify;
  text-justify: inter-ideograph;
}

.post-body h2 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 2.75em 0 0.7em;
  line-height: 1.3;
}

.post-body h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 2.25em 0 0.6em;
}

.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.6rem 1.25rem;
  margin: 1.75em 0;
  border-radius: 0 3px 3px 0;
  font-style: italic;
  color: var(--muted);
}

.post-body blockquote p { margin-bottom: 0; }

.post-body strong { font-weight: 700; }
.post-body em { font-style: italic; }

.post-body a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-body code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.87em;
  color: var(--muted);
}

.post-body pre {
  background: var(--rule);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.75em 0;
}

.post-body pre code {
  color: var(--text);
  font-size: 0.85em;
}

/* ── Post images ─────────────────────────── */

.post-body img {
  width: 100%;
  height: auto;
  display: block;
  margin: 2em 0;
  border-radius: 6px;
  border: 1px solid var(--rule);
}

.post-body figure {
  margin: 2.5em 0;
}

.post-body figcaption {
  font-size: 0.78rem;
  font-family: system-ui, 'Helvetica Neue', sans-serif;
  color: var(--muted);
  margin-top: 0.6rem;
  line-height: 1.5;
  text-align: center;
}

/* ── Post footer ─────────────────────────── */

.post-foot {
  border-top: 1px solid var(--rule);
  padding-top: 2rem;
  margin-bottom: 5rem;
}

.post-foot-tags {
  font-size: 0.8rem;
  font-family: system-ui, 'Helvetica Neue', sans-serif;
  color: var(--muted);
  margin-bottom: 2rem;
}

.post-foot-tags span { margin-right: 0.6rem; }

/* ── Author note ─────────────────────────── */

/* ── Social Share ────────────────────────── */

.share-card {
  margin-top: 2rem;
  padding: 1.5rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: rgba(0,0,0,0.015);
}

[data-theme="dark"] .share-card {
  background: rgba(255,255,255,0.02);
}

.share-card-header { font-weight: 700; margin-bottom: 0.5rem; font-size: 1.05rem; }
.share-card-desc { font-size: 0.9rem; color: var(--muted); margin-bottom: 1.25rem; }

.share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.share-btn {
  width: 100%;
  padding: 0.65rem 1rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-align: center;
}

.share-btn:hover {
  background: var(--rule);
}

.share-btn.primary {
  grid-column: 1 / -1;
  background: rgba(255, 36, 66, 0.08);
  color: #ff2442;
  border-color: #ff2442;
}

[data-theme="dark"] .share-btn.primary {
  background: rgba(255, 36, 66, 0.15);
}

.share-btn.primary:hover {
  background: #ff2442;
  color: #fff;
}

/* ── Author note ─────────────────────────── */

.author-note {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  padding: 1.75rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: rgba(0,0,0,0.02);
  margin-bottom: 2rem;
}

[data-theme="dark"] .author-note {
  background: rgba(255,255,255,0.02);
}

.author-note-body {
  flex: 1;
}

.author-img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.author-note p {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 0.5rem;
}

.author-note p strong {
  color: var(--text);
  font-weight: 700;
}

.author-note a {
  font-size: 0.82rem;
  font-family: system-ui, 'Helvetica Neue', sans-serif;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.author-note a:hover { color: var(--text); }



/* ── About ───────────────────────────────── */

.about { padding-bottom: 6rem; }

.about-mascot {
  text-align: center;
  margin-bottom: 2rem;
}

.about-mascot img {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.about h1 {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
}

.about p { font-size: 1.05rem; line-height: 1.85; margin-bottom: 1.4em; }
.about p.muted { color: var(--muted); }
.about a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* ── Footer ──────────────────────────────── */

footer.site {
  border-top: 1px solid var(--rule);
  padding: 2rem 0 3rem;
}

footer.site p {
  font-size: 0.78rem;
  font-family: system-ui, 'Helvetica Neue', sans-serif;
  color: var(--muted);
  text-align: center;
}

footer.site a { color: var(--muted); text-decoration: none; }
footer.site a:hover { color: var(--text); }

.footer-craft {
  font-style: italic;
  font-size: 0.72rem;
  color: var(--rule);
  margin-top: 0.4rem;
  letter-spacing: 0.04em;
  font-family: system-ui, 'Helvetica Neue', sans-serif;
}

/* ── Archive ─────────────────────────────── */

.archive-year {
  margin-bottom: 2.5rem;
}

.archive-year h2 {
  font-size: 0.78rem;
  font-family: system-ui, 'Helvetica Neue', sans-serif;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}

.archive-year ul {
  list-style: none;
}

.archive-year li {
  display: flex;
  gap: 1.25rem;
  align-items: baseline;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.95rem;
}

.archive-date {
  font-size: 0.78rem;
  font-family: system-ui, 'Helvetica Neue', sans-serif;
  color: var(--muted);
  white-space: nowrap;
  min-width: 110px;
}

.archive-year a {
  color: var(--text);
  text-decoration: none;
}

.archive-year a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Progress bar ────────────────────────── */

#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--accent);
  z-index: 999;
  transition: width 0.1s linear;
}

/* ── Responsive ──────────────────────────── */

@media (max-width: 600px) {
  .site-inner { flex-direction: column; align-items: flex-start; gap: 1rem; }
  nav { flex-wrap: wrap; gap: 1rem; }
  header.site { padding: 1.5rem 0; margin-bottom: 2.5rem; }
  .hero { margin-bottom: 3rem; }
  .post-item--has-thumb { grid-template-columns: 1fr; gap: 1rem; }
  .post-item-thumb { aspect-ratio: 16 / 9; }
  .author-note { flex-direction: column; text-align: center; }

}
