/* ── Fonts ── */
@import url("https://cdn.jsdelivr.net/npm/lxgw-wenkai-webfont@1.7.0/style.css");
@import url("https://cdn.jsdelivr.net/gh/codex-src/iA-Fonts@master/iA%20Writer%20Mono/Webfonts/stylesheet.css");

/* Boost Times for Latin/ASCII only, leaving CJK at base size */
@font-face {
  font-family: "TimesScaled";
  src: local("Times"), local("Times New Roman");
  size-adjust: 108%;
  unicode-range: U+0020-007F, U+00A0-00FF, U+0100-024F;
}

/* ── Tokens ── */
:root {
  --bg:        #fafaf8;
  --fg:        #1a1a1a;
  --muted:     #6b6b6b;
  --border:    #e2e2de;
  --max-w:     900px;
  --font-body: "TimesScaled", "Times", "Times New Roman", "LXGW WenKai", serif;
  --font-mono: "iA Writer Mono S", monospace;
  --code-bg:   #f0eeeb;
  --accent:    #c0392b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #161614;
    --fg:      #e8e6e3;
    --muted:   #888884;
    --border:  #2e2e2a;
    --code-bg: #232320;
    --accent:  #e05a4a;
  }
}

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

/* ── Base ── */
html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  line-height: 1.85;
  padding: 1.5rem 1.5rem 4rem;
}

/* ── Layout ── */
.site-wrap {
  max-width: 680px;
  margin: 0 auto;
}

/* ── Header ── */
.site-header {
  padding-top: 0.6rem;
  margin-bottom: 0;
}

.site-header-inner {
  max-width: 680px;
  margin: 0 auto;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--fg);
}

.site-title {
  font-size: 1.1rem;
  font-weight: 400;
  text-decoration: none;
  color: var(--fg);
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
}

.site-title:hover { color: var(--accent); }

/* ── Home ── */
.home-subtitle {
  font-size: 1rem;
  color: var(--fg);
  margin-top: 2rem;
  margin-bottom: 2rem;
}

/* ── Post list ── */
.post-list {
  list-style: none;
}

.post-list li {
  margin-bottom: 1.25rem;
}

.post-title {
  display: block;
  font-size: 1.1rem;
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  line-height: 1.35;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.post-title:hover {
  color: var(--accent);
  text-decoration-color: #aaa9a4;
}

.post-meta {
  font-size: 0.85rem;
  color: var(--fg);
  margin-top: 0.1rem;
}

.post-summary { font-style: normal; }

/* ── Article ── */
.article-header {
  text-align: center;
  padding: 2rem 0 1.5rem;
  margin-bottom: 0;
  border-bottom: 1px solid var(--fg);
}

.article-title {
  font-size: 2rem;
  line-height: 1.2;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.article-meta {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  align-items: center;
}

.article-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.tag {
  font-size: 0.8rem;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.05em 0.5em;
  border-radius: 3px;
  text-decoration: none;
}

.tag:hover { color: var(--fg); border-color: var(--fg); }

/* ── Prose ── */
.prose {
  margin-top: 2.5rem;
}

.prose h1, .prose h2, .prose h3, .prose h4 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  line-height: 1.3;
  font-weight: 500;
}

.prose h2 { font-size: 1.25rem; }
.prose h3 { font-size: 1.05rem; }

.prose p { margin-bottom: 1rem; }

.prose a { color: var(--accent); text-underline-offset: 3px; transition: opacity 0.2s ease; }
.prose a:hover { opacity: 0.75; }

.prose blockquote {
  border-left: 2px solid var(--border);
  padding-left: 1rem;
  color: var(--muted);
  margin: 1.25rem 0;
  font-style: italic;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.prose pre {
  background: var(--code-bg);
  padding: 1rem 1.25rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1.25rem 0;
}

.prose pre code { background: none; padding: 0; font-size: 0.82rem; }

.prose img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem auto;
}

.prose iframe {
  display: block;
  margin: 1.5rem auto;
}

.prose ul, .prose ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.prose li { margin-bottom: 0.25rem; }

.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.75rem 0;
}

/* ── Article footer ── */
.article-footer {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.article-footer-meta {
  display: table;
  border-spacing: 0 0.3rem;
  font-size: 0.875rem;
}

.article-footer-row {
  display: table-row;
}

.article-footer-label {
  display: table-cell;
  color: var(--muted);
  font-weight: 500;
  padding-right: 1.5rem;
  white-space: nowrap;
  text-align: right;
}

.article-footer-row span:last-child,
.article-footer-row a {
  display: table-cell;
  color: var(--fg);
  text-decoration: none;
}

.article-footer-row a { transition: color 0.2s ease; }
.article-footer-row a:hover { color: var(--accent); }

.article-footer .article-tags {
  display: table-cell;
  vertical-align: middle;
  gap: 0.35rem;
}

/* ── Comments ── */
.comments { margin-top: 2.5rem; }

/* ── Tags page ── */
.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.tag-list li a {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.2em 0.75em;
  border-radius: 4px;
  text-decoration: none;
}

.tag-list li a:hover { color: var(--fg); border-color: var(--fg); }

.tag-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* ── Footer ── */
.site-footer {
  margin-top: 3.5rem;
  color: var(--fg);
}

.footer-nav {
  display: flex;
  justify-content: space-between;
  padding: 0.65rem 0;
  border-top: 1px solid var(--fg);
  border-bottom: 1px solid var(--fg);
  font-size: 1.05rem;
}

.footer-nav a {
  color: var(--fg);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-nav a:hover { color: var(--accent); }

.footer-sep {
  color: var(--fg);
  flex: 1;
  text-align: center;
}

.footer-copy { font-size: 0.8rem; color: var(--fg); padding-top: 0.65rem; }

/* ── Page title ── */
.page-title {
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  body { padding: 1rem 1rem 3rem; }
  .article-title { font-size: 1.6rem; }
}
